Commit e8899b56 authored by George Zagaris's avatar George Zagaris
Browse files

DEBUG: Added some debug prints

Added some print out statements for debugging
parent 61c4fd31
......@@ -19,6 +19,12 @@
#include <mpi.h>
#include "vtkUniformGrid.h"
#include "vtkDataArray.h"
#include "vtkDoubleArray.h"
#include "vtkCell.h"
#include "vtkPoints.h"
#include "vtkPointData.h"
#include "vtkCellData.h"
#include "vtkAMRBox.h"
#include "vtkAMRConnectivityFilter.h"
#include "vtkAMRDataTransferFilter.h"
......@@ -53,7 +59,7 @@ int main( int argc, char **argv )
vtkAssertUtils::assertEquals(
amrData->GetNumberOfDataSets(0),1,__FILE__,__LINE__);
vtkAssertUtils::assertEquals(
amrData->GetNumberOfDataSets(1),1,__FILE__,__LINE__ );
amrData->GetNumberOfDataSets(1),2,__FILE__,__LINE__ );
WriteAMRData( amrData, "Input" );
......@@ -88,7 +94,7 @@ int main( int argc, char **argv )
transferFilter->SetController( Controller );
transferFilter->SetAMRDataSet( amrData );
transferFilter->SetNumberOfGhostLayers( 1 );
transferFilter->SetNumberOfGhostLayers( 2 );
transferFilter->SetRemoteConnectivity(
connectivityFilter->GetRemoteConnectivity() );
transferFilter->SetLocalConnectivity(
......@@ -140,9 +146,10 @@ vtkHierarchicalBoxDataSet* GetAMRDataSet( )
{
case 0:
{
// BLOCK 0
vtkAssertUtils::assertEquals( dim, 2, __FILE__, __LINE__ );
ndim[0] = 11;
ndim[1] = 10;
ndim[0] = 25;
ndim[1] = 25;
ndim[2] = 1;
origin[0] = 0.0;
origin[1] = 0.0;
......@@ -150,11 +157,12 @@ vtkHierarchicalBoxDataSet* GetAMRDataSet( )
blockId = 0;
level = 0;
h[0] = h[1] = h[2] = 0.5;
vtkAMRBox myBox(origin,dim,ndim,h,blockId,level,rank);
vtkAMRBox rmtBox0(origin,dim,ndim,h,blockId,level,rank);
vtkUniformGrid *myGrid = GetGrid( origin,h,ndim );
vtkAssertUtils::assertNotNull( myGrid, __FILE__, __LINE__ );
data->SetDataSet( level,0,myBox,myGrid);
data->SetDataSet( level,0,rmtBox0,myGrid);
// BLOCK 1
ndim[0] = 10;
ndim[1] = 7;
ndim[2] = 1;
......@@ -164,12 +172,26 @@ vtkHierarchicalBoxDataSet* GetAMRDataSet( )
blockId = 1;
level = 1;
h[0] = h[1] = h[2] = 0.25;
vtkAMRBox rmtBox(origin,dim,ndim,h,blockId,level,blockId%numProcs);
data->SetDataSet( level,0,rmtBox,NULL);
vtkAMRBox rmtBox1(origin,dim,ndim,h,blockId,level,blockId%numProcs);
data->SetDataSet( level,0,rmtBox1,NULL);
// BLOCK 2
ndim[0] = 10;
ndim[1] = 7;
ndim[2] = 1;
origin[0] = 1.0;
origin[1] = 3.0;
origin[2] = 0.0;
blockId = 2;
level = 1;
h[0] = h[1] = h[2] = 0.25;
vtkAMRBox rmtBox2(origin,dim,ndim,h,blockId,level,blockId%numProcs);
data->SetDataSet( level,1,rmtBox2,NULL);
}
break;
case 1:
{
// BLOCK 1
vtkAssertUtils::assertEquals( dim, 2, __FILE__, __LINE__ );
ndim[0] = 10;
ndim[1] = 7;
......@@ -180,13 +202,14 @@ vtkHierarchicalBoxDataSet* GetAMRDataSet( )
blockId = 1;
level = 1;
h[0] = h[1] = h[2] = 0.25;
vtkAMRBox myBox(origin,dim,ndim,h,blockId,level,rank);
vtkAMRBox rmtBox1(origin,dim,ndim,h,blockId,level,rank);
vtkUniformGrid *myGrid = GetGrid( origin,h,ndim );
vtkAssertUtils::assertNotNull( myGrid, __FILE__, __LINE__ );
data->SetDataSet( level,0,myBox,myGrid);
data->SetDataSet( level,0,rmtBox1,myGrid);
ndim[0] = 11;
ndim[1] = 10;
// BLOCK 0
ndim[0] = 25;
ndim[1] = 25;
ndim[2] = 1;
origin[0] = 0.0;
origin[1] = 0.0;
......@@ -194,8 +217,65 @@ vtkHierarchicalBoxDataSet* GetAMRDataSet( )
blockId = 0;
level = 0;
h[0] = h[1] = h[2] = 0.5;
vtkAMRBox rmtBox(origin,dim,ndim,h,blockId,level,blockId%numProcs);
data->SetDataSet( level,0,rmtBox,NULL);
vtkAMRBox rmtBox0(origin,dim,ndim,h,blockId,level,blockId%numProcs);
data->SetDataSet( level,0,rmtBox0,NULL);
// BLOCK 2
ndim[0] = 10;
ndim[1] = 7;
ndim[2] = 1;
origin[0] = 1.0;
origin[1] = 3.0;
origin[2] = 0.0;
blockId = 2;
level = 1;
h[0] = h[1] = h[2] = 0.25;
vtkAMRBox rmtBox2(origin,dim,ndim,h,blockId,level,blockId%numProcs);
data->SetDataSet( level,1,rmtBox2,NULL);
}
break;
case 2:
{
// BLOCK 2
ndim[0] = 10;
ndim[1] = 7;
ndim[2] = 1;
origin[0] = 1.0;
origin[1] = 3.0;
origin[2] = 0.0;
blockId = 2;
level = 1;
h[0] = h[1] = h[2] = 0.25;
vtkAMRBox rmtBox2(origin,dim,ndim,h,blockId,level,blockId%numProcs);
vtkUniformGrid *myGrid = GetGrid( origin,h,ndim );
vtkAssertUtils::assertNotNull( myGrid, __FILE__, __LINE__ );
data->SetDataSet( level,1,rmtBox2,NULL);
// BLOCK 0
ndim[0] = 25;
ndim[1] = 25;
ndim[2] = 1;
origin[0] = 0.0;
origin[1] = 0.0;
origin[2] = 0.0;
blockId = 0;
level = 0;
h[0] = h[1] = h[2] = 0.5;
vtkAMRBox rmtBox0(origin,dim,ndim,h,blockId,level,blockId%numProcs);
data->SetDataSet( level,0,rmtBox0,NULL);
// BLOCK 1
ndim[0] = 10;
ndim[1] = 7;
ndim[2] = 1;
origin[0] = 1.5;
origin[1] = 1.5;
origin[2] = 0.0;
blockId = 1;
level = 1;
h[0] = h[1] = h[2] = 0.25;
vtkAMRBox rmtBox1(origin,dim,ndim,h,blockId,level,blockId%numProcs);
data->SetDataSet( level,0,rmtBox1,NULL);
}
break;
default:
......@@ -215,5 +295,42 @@ vtkUniformGrid* GetGrid( double *origin, double *spacing, int *ndim )
grd->SetOrigin( origin );
grd->SetSpacing( spacing );
grd->SetDimensions( ndim );
vtkDoubleArray* xyz = vtkDoubleArray::New( );
xyz->SetName( "XYZ" );
xyz->SetNumberOfComponents( 1 );
xyz->SetNumberOfTuples( grd->GetNumberOfCells() );
for( int cellIdx=0; cellIdx < grd->GetNumberOfCells(); ++cellIdx )
{
vtkCell* myCell = grd->GetCell( cellIdx);
vtkAssertUtils::assertNotNull( myCell, __FILE__, __LINE__ );
vtkPoints *cellPoints = myCell->GetPoints();
vtkAssertUtils::assertNotNull( cellPoints, __FILE__, __LINE__ );
double xyzCenter[3];
xyzCenter[0] = 0.0;
xyzCenter[1] = 0.0;
xyzCenter[2] = 0.0;
for( int cp=0; cp < cellPoints->GetNumberOfPoints(); ++cp )
{
double pnt[3];
cellPoints->GetPoint( cp, pnt );
xyzCenter[0] += pnt[0];
xyzCenter[1] += pnt[1];
xyzCenter[2] += pnt[2];
} // END for all cell points
xyzCenter[0] = xyzCenter[0] / (cellPoints->GetNumberOfPoints());
xyzCenter[1] = xyzCenter[1] / (cellPoints->GetNumberOfPoints());
xyzCenter[2] = xyzCenter[2] / (cellPoints->GetNumberOfPoints());
double f = xyzCenter[0]*xyzCenter[0] +
xyzCenter[1]*xyzCenter[1] + xyzCenter[2]*xyzCenter[2];
xyz->SetTuple1(cellIdx,f);
} // END for all cells
grd->GetCellData()->AddArray(xyz);
return grd;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment