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

BUGFIX: Call Modified() in setters

Change-Id: I39df1019314456e1ea0739463aa5c89404d49df1
parent e0e9b1f8
......@@ -129,58 +129,52 @@ vtkUniformGrid* vtkAMRGaussianPulseSource::GetGrid(
return( grid );
}
//------------------------------------------------------------------------------
vtkUniformGrid* vtkAMRGaussianPulseSource::GetRootAMR()
{
double origin[3];
double h[3];
int ndim[3];
vtkUniformGrid *grid = NULL;
origin[0] = origin[1] = origin[2] = 0.0;
h[0] = h[1] = h[2] = 1.0;
switch( this->Dimension )
{
case 2:
origin[0] = origin[1] = -5.0;
ndim[0] = ndim[1] = 10;
ndim[2] = 1;
break;
case 3:
origin[0] = origin[1] = origin[2] = -5.0;
ndim[0] = ndim[1] = ndim[2] = 10;
break;
default:
vtkErrorMacro( "ERROR: Invalid grid dimension!\n" );
assert("ERROR: code should not reach here!" && false);
}
grid = this->GetGrid( origin, h, ndim );
assert("ERROR: cannot create root AMR grid!" && (grid != NULL) );
return( grid );
}
//------------------------------------------------------------------------------
void vtkAMRGaussianPulseSource::Generate2DDataSet( vtkOverlappingAMR *amr )
{
assert("pre: input amr dataset is NULL" && (amr != NULL));
assert( "pre: input amr dataset is NULL" && (amr != NULL) );
vtkUniformGrid *root = this->GetRootAMR();
amr->SetNumberOfLevels( this->NumberOfLevels );
amr->SetDataSet(0,0, root);
root->Delete();
int ndim[3];
double origin[3];
double h[3];
int blockId = 0;
int level = 0;
// Root Block -- Block 0,0
ndim[0] = 6; ndim[1] = 6; ndim[2] = 1;
h[0] = h[1] = h[2] = this->RootSpacing[0];
origin[0] = origin[1] = -2.0; origin[2] = 0.0;
blockId = 0;
level = 0;
vtkUniformGrid *grid = this->GetGrid(origin, h, ndim);
amr->SetDataSet(level,blockId,grid);
grid->Delete();
vtkAMRUtilities::GenerateMetaData( amr, NULL );
amr->GenerateVisibilityArrays();
}
//------------------------------------------------------------------------------
void vtkAMRGaussianPulseSource::Generate3DDataSet( vtkOverlappingAMR *amr )
{
assert("pre: input amr dataset is NULL" && (amr != NULL));
assert("pre: input AMR dataset is NULL" && (amr != NULL) );
vtkUniformGrid *root = this->GetRootAMR();
amr->SetNumberOfLevels( this->NumberOfLevels );
amr->SetDataSet(0,0, root);
root->Delete();
int ndim[3];
double origin[3];
double h[3];
int blockId = 0;
int level = 0;
// Root Block -- Block 0,0
ndim[0] = 6; ndim[1] = 6; ndim[2] = 6;
h[0] = h[1] = h[2] = this->RootSpacing[0];
origin[0] = origin[1] = -2.0; origin[2] = 0.0;
blockId = 0;
level = 0;
vtkUniformGrid *grid = this->GetGrid(origin, h, ndim);
amr->SetDataSet(level,blockId,grid);
grid->Delete();
vtkAMRUtilities::GenerateMetaData( amr, NULL );
amr->GenerateVisibilityArrays();
}
//------------------------------------------------------------------------------
......
......@@ -46,28 +46,38 @@ class VTK_AMR_EXPORT vtkAMRGaussianPulseSource :
// Description:
// Set the refinement ratio
void SetRefinementRatio(int r) {this->RefinmentRatio=r;}
void SetRefinementRatio(int r)
{this->RefinmentRatio=r;this->Modified();}
// Description:
// Set the root spacing
void SetRootSpacing(double h0)
{this->RootSpacing[0]=this->RootSpacing[1]=this->RootSpacing[2]=h0;}
{
this->RootSpacing[0]=this->RootSpacing[1]=this->RootSpacing[2]=h0;
this->Modified();
}
// Description:
// Set & Get macro for the pulse origin
vtkSetVector3Macro(PulseOrigin,double);
vtkGetVector3Macro(PulseOrigin,double);
void SetXPulseOrigin(double f){this->PulseOrigin[0]=f;}
void SetYPulseOrigin(double f){this->PulseOrigin[1]=f;}
void SetZPulseOrigin(double f){this->PulseOrigin[2]=f;}
void SetXPulseOrigin(double f)
{this->PulseOrigin[0]=f;this->Modified();}
void SetYPulseOrigin(double f)
{this->PulseOrigin[1]=f;this->Modified();}
void SetZPulseOrigin(double f)
{this->PulseOrigin[2]=f;this->Modified();}
// Description:
// Set & Get macro for the pulse width
vtkSetVector3Macro(PulseWidth,double);
vtkGetVector3Macro(PulseWidth,double);
void SetXPulseWidth(double f){this->PulseWidth[0]=f;}
void SetYPulseWidth(double f){this->PulseWidth[1]=f;}
void SetZPulseWidth(double f){this->PulseWidth[2]=f;}
void SetXPulseWidth(double f)
{this->PulseWidth[0]=f;this->Modified();}
void SetYPulseWidth(double f)
{this->PulseWidth[1]=f;this->Modified();}
void SetZPulseWidth(double f)
{this->PulseWidth[2]=f;this->Modified();}
// Description:
// Set & Get macro for the pulse amplitude
......@@ -108,10 +118,6 @@ class VTK_AMR_EXPORT vtkAMRGaussianPulseSource :
// dimensions.
vtkUniformGrid* GetGrid( double origin[3], double h[3], int ndim[3] );
// Description:
// Construct the root uniform grid AMR.
vtkUniformGrid* GetRootAMR();
// Description:
// Generate 2-D or 3-D DataSet
void Generate2DDataSet(vtkOverlappingAMR* amr);
......
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