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

ENH: DataTransfer Error Quantification

Implemented functionality to compute the error in
the data-transfer for the gaussian pulse transfer
example.
parent 9a75d37e
...@@ -44,6 +44,7 @@ vtkMultiProcessController *Controller; ...@@ -44,6 +44,7 @@ vtkMultiProcessController *Controller;
vtkHierarchicalBoxDataSet* GetSerialAMRDataSet(); vtkHierarchicalBoxDataSet* GetSerialAMRDataSet();
vtkHierarchicalBoxDataSet* GetParallelAMRDataSet(); vtkHierarchicalBoxDataSet* GetParallelAMRDataSet();
vtkUniformGrid* GetGrid( double* origin,double* h,int* ndim ); vtkUniformGrid* GetGrid( double* origin,double* h,int* ndim );
void ComputeGaussianPulseError( vtkHierarchicalBoxDataSet *amrData );
// //
// Main // Main
...@@ -102,13 +103,17 @@ int main( int argc, char **argv ) ...@@ -102,13 +103,17 @@ int main( int argc, char **argv )
transferFilter->SetController( Controller ); transferFilter->SetController( Controller );
transferFilter->SetAMRDataSet( amrData ); transferFilter->SetAMRDataSet( amrData );
transferFilter->SetNumberOfGhostLayers( 2 ); transferFilter->SetNumberOfGhostLayers( 1 );
transferFilter->SetRemoteConnectivity( transferFilter->SetRemoteConnectivity(
connectivityFilter->GetRemoteConnectivity() ); connectivityFilter->GetRemoteConnectivity() );
transferFilter->SetLocalConnectivity( transferFilter->SetLocalConnectivity(
connectivityFilter->GetLocalConnectivity() ); connectivityFilter->GetLocalConnectivity() );
transferFilter->Transfer(); transferFilter->Transfer();
vtkHierarchicalBoxDataSet *newData = transferFilter->GetExtrudedData();
assert( "extruded data is NULL!" && (newData != NULL) );
ComputeGaussianPulseError( newData );
std::cout << "[DONE]\n"; std::cout << "[DONE]\n";
std::cout.flush(); std::cout.flush();
Controller->Barrier(); Controller->Barrier();
...@@ -127,6 +132,34 @@ int main( int argc, char **argv ) ...@@ -127,6 +132,34 @@ int main( int argc, char **argv )
// Function Prototype Implementation // Function Prototype Implementation
//============================================================================= //=============================================================================
//------------------------------------------------------------------------------
void ComputeGaussianPulseError( vtkHierarchicalBoxDataSet *data )
{
// Sanity check
assert( "pre: data is NULL!" && (data != NULL) );
for( unsigned int level=0; level < data->GetNumberOfLevels(); ++level )
{
for( unsigned int idx=0; idx < data->GetNumberOfDataSets(level); ++idx)
{
vtkUniformGrid *ug = data->GetDataSet(level,idx);
if( ug != NULL )
{
vtkDoubleArray *err = vtkDoubleArray::New();
err->SetNumberOfComponents( 1 );
err->SetNumberOfValues( ug->GetNumberOfCells() );
for( int cell=0; cell < ug->GetNumberOfCells(); ++cell )
{
//TODO: implement this
}// END for all grid cells
}
} // END for all data
} // END for all levels
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
vtkHierarchicalBoxDataSet* GetSerialAMRDataSet( ) vtkHierarchicalBoxDataSet* GetSerialAMRDataSet( )
{ {
......
Supports Markdown
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