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  =========================================================================*/
30 #ifndef vtkAMRGaussianPulseSource_h
31 #define vtkAMRGaussianPulseSource_h
32 
33 #include "vtkFiltersAMRModule.h" // For export macro
35 
36 #include <cmath> // For std::exp
37 
38 class vtkOverlappingAMR;
39 class vtkUniformGrid;
40 class vtkInformation;
42 
43 class VTKFILTERSAMR_EXPORT vtkAMRGaussianPulseSource :
45 {
46 public:
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
52 
55  vtkSetMacro(Dimension,int);
57 
59 
62  vtkSetMacro(NumberOfLevels,int);
64 
68  void SetRefinementRatio(int r)
69  {this->RefinmentRatio=r;this->Modified();}
70 
72 
75  void SetRootSpacing(double h0)
76  {
77  this->RootSpacing[0]=this->RootSpacing[1]=this->RootSpacing[2]=h0;
78  this->Modified();
79  }
81 
83 
86  vtkSetVector3Macro(PulseOrigin,double);
87  vtkGetVector3Macro(PulseOrigin,double);
88  void SetXPulseOrigin(double f)
89  {this->PulseOrigin[0]=f;this->Modified();}
90  void SetYPulseOrigin(double f)
91  {this->PulseOrigin[1]=f;this->Modified();}
92  void SetZPulseOrigin(double f)
93  {this->PulseOrigin[2]=f;this->Modified();}
95 
97 
100  vtkSetVector3Macro(PulseWidth,double);
101  vtkGetVector3Macro(PulseWidth,double);
102  void SetXPulseWidth(double f)
103  {this->PulseWidth[0]=f;this->Modified();}
104  void SetYPulseWidth(double f)
105  {this->PulseWidth[1]=f;this->Modified();}
106  void SetZPulseWidth(double f)
107  {this->PulseWidth[2]=f;this->Modified();}
109 
111 
114  vtkSetMacro(PulseAmplitude,double);
115  vtkGetMacro(PulseAmplitude,double);
117 
118 protected:
120  ~vtkAMRGaussianPulseSource() override;
121 
126  int RequestData(vtkInformation *request,
127  vtkInformationVector **inputVector,
128  vtkInformationVector *outputVector) override;
129 
131 
135  double ComputePulseAt(const double x, const double y, const double z)
136  {
137  double xyz[3]; xyz[0]=x; xyz[1]=y; xyz[2]=z;
138  return( this->ComputePulseAt(xyz) );
139  }
140  double ComputePulseAt( double pt[3] )
141  {
142  double pulse = 0.0;
143  double r = 0.0;
144  for( int i=0; i < this->Dimension; ++i )
145  {
146  double d = pt[i]-this->PulseOrigin[i];
147  double d2 = d*d;
148  double L2 = this->PulseWidth[i]*this->PulseWidth[i];
149  r += d2/L2;
150  }
151  pulse = this->PulseAmplitude*std::exp( -r );
152  return( pulse );
153  }
155 
160  void ComputeCellCenter(vtkUniformGrid *grid,
161  vtkIdType cellIdx,
162  double centroid[3] );
163 
167  void GeneratePulseField(vtkUniformGrid *grid);
168 
173  vtkUniformGrid* GetGrid( double origin[3], double h[3], int ndim[3] );
174 
178  vtkUniformGrid* RefinePatch(vtkUniformGrid* parent, int patchExtent[6]);
179 
181 
184  void Generate2DDataSet(vtkOverlappingAMR* amr);
185  void Generate3DDataSet(vtkOverlappingAMR* amr);
187 
188  double RootSpacing[3];
189  double PulseOrigin[3];
190  double PulseWidth[3];
195 
196 private:
198  void operator=(const vtkAMRGaussianPulseSource&) = delete;
199 };
200 
201 #endif /* vtkAMRGaussianPulseSource_h */
void SetZPulseOrigin(double f)
Set & Get macro for the pulse origin.
void SetYPulseWidth(double f)
Set & 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 & Get macro for the pulse width.
int vtkIdType
Definition: vtkType.h:347
double ComputePulseAt(const double x, const double y, const double z)
Computes the gaussian pulse at the given location based on the user supplied parameters for pulse wid...
a simple class to control print indentation
Definition: vtkIndent.h:39
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...
image data with blanking
void SetYPulseOrigin(double f)
Set & Get macro for the pulse origin.
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
hierarchical dataset of vtkUniformGrids
void SetZPulseWidth(double f)
Set & 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 & 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.