VTK
vtkAMRGaussianPulseSource.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAMRGaussianPulseSource.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14  =========================================================================*/
27 #ifndef vtkAMRGaussianPulseSource_h
28 #define vtkAMRGaussianPulseSource_h
29 
30 #include "vtkFiltersAMRModule.h" // For export macro
32 
33 #include <cmath> // For std::exp
34 
35 class vtkOverlappingAMR;
36 class vtkUniformGrid;
37 class vtkInformation;
39 
40 class VTKFILTERSAMR_EXPORT vtkAMRGaussianPulseSource :
42 {
43 public:
46  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
47 
49 
52  vtkSetMacro(Dimension,int);
54 
56 
59  vtkSetMacro(NumberOfLevels,int);
61 
65  void SetRefinementRatio(int r)
66  {this->RefinmentRatio=r;this->Modified();}
67 
69 
72  void SetRootSpacing(double h0)
73  {
74  this->RootSpacing[0]=this->RootSpacing[1]=this->RootSpacing[2]=h0;
75  this->Modified();
76  }
78 
80 
83  vtkSetVector3Macro(PulseOrigin,double);
84  vtkGetVector3Macro(PulseOrigin,double);
85  void SetXPulseOrigin(double f)
86  {this->PulseOrigin[0]=f;this->Modified();}
87  void SetYPulseOrigin(double f)
88  {this->PulseOrigin[1]=f;this->Modified();}
89  void SetZPulseOrigin(double f)
90  {this->PulseOrigin[2]=f;this->Modified();}
92 
94 
97  vtkSetVector3Macro(PulseWidth,double);
98  vtkGetVector3Macro(PulseWidth,double);
99  void SetXPulseWidth(double f)
100  {this->PulseWidth[0]=f;this->Modified();}
101  void SetYPulseWidth(double f)
102  {this->PulseWidth[1]=f;this->Modified();}
103  void SetZPulseWidth(double f)
104  {this->PulseWidth[2]=f;this->Modified();}
106 
108 
111  vtkSetMacro(PulseAmplitude,double);
112  vtkGetMacro(PulseAmplitude,double);
114 
115 protected:
117  ~vtkAMRGaussianPulseSource() VTK_OVERRIDE;
118 
123  int RequestData(vtkInformation *request,
124  vtkInformationVector **inputVector,
125  vtkInformationVector *outputVector) VTK_OVERRIDE;
126 
128 
132  double ComputePulseAt(const double x, const double y, const double z)
133  {
134  double xyz[3]; xyz[0]=x; xyz[1]=y; xyz[2]=z;
135  return( this->ComputePulseAt(xyz) );
136  }
137  double ComputePulseAt( double pt[3] )
138  {
139  double pulse = 0.0;
140  double r = 0.0;
141  for( int i=0; i < this->Dimension; ++i )
142  {
143  double d = pt[i]-this->PulseOrigin[i];
144  double d2 = d*d;
145  double L2 = this->PulseWidth[i]*this->PulseWidth[i];
146  r += d2/L2;
147  }
148  pulse = this->PulseAmplitude*std::exp( -r );
149  return( pulse );
150  }
152 
157  void ComputeCellCenter(vtkUniformGrid *grid,
158  vtkIdType cellIdx,
159  double centroid[3] );
160 
164  void GeneratePulseField(vtkUniformGrid *grid);
165 
170  vtkUniformGrid* GetGrid( double origin[3], double h[3], int ndim[3] );
171 
175  vtkUniformGrid* RefinePatch(vtkUniformGrid* parent, int patchExtent[6]);
176 
178 
181  void Generate2DDataSet(vtkOverlappingAMR* amr);
182  void Generate3DDataSet(vtkOverlappingAMR* amr);
184 
185  double RootSpacing[3];
186  double PulseOrigin[3];
187  double PulseWidth[3];
192 
193 private:
194  vtkAMRGaussianPulseSource(const vtkAMRGaussianPulseSource&) VTK_DELETE_FUNCTION;
195  void operator=(const vtkAMRGaussianPulseSource&) VTK_DELETE_FUNCTION;
196 };
197 
198 #endif /* vtkAMRGaussianPulseSource_h */
void SetZPulseOrigin(double f)
Set &amp; Get macro for the pulse origin.
void SetYPulseWidth(double f)
Set &amp; Get macro for the pulse width.
A base class for all algorithms that take as input vtkOverlappingAMR and produce vtkOverlappingAMR.
Store vtkAlgorithm input/output information.
A source that generates sample AMR data with gaussian pulse field.
void SetXPulseWidth(double f)
Set &amp; Get macro for the pulse width.
int vtkIdType
Definition: vtkType.h:345
a simple class to control print indentation
Definition: vtkIndent.h:33
void SetRootSpacing(double h0)
Set the root spacing.
virtual void Modified()
Update the modification time for this object.
double ComputePulseAt(double pt[3])
Computes the gaussian pulse at the given location based on the user supplied parameters for pulse wid...
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
image data with blanking
void SetYPulseOrigin(double f)
Set &amp; Get macro for the pulse origin.
hierarchical dataset of vtkUniformGrids
void SetZPulseWidth(double f)
Set &amp; Get macro for the pulse width.
Store zero or more vtkInformation instances.
void SetRefinementRatio(int r)
Set the refinement ratio.
void SetXPulseOrigin(double f)
Set &amp; Get macro for the pulse origin.
static vtkOverlappingAMRAlgorithm * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.