VTK  9.2.6
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 =========================================================================*/
29
30#ifndef vtkAMRGaussianPulseSource_h
31#define vtkAMRGaussianPulseSource_h
32
33#include "vtkFiltersAMRModule.h" // For export macro
35
36#include <cmath> // For std::exp
37
39class vtkUniformGrid;
40class vtkInformation;
42
43class VTKFILTERSAMR_EXPORT vtkAMRGaussianPulseSource : public vtkOverlappingAMRAlgorithm
44{
45public:
48 void PrintSelf(ostream& os, vtkIndent indent) override;
49
51
54 vtkSetMacro(Dimension, int);
56
58
61 vtkSetMacro(NumberOfLevels, int);
63
68 {
69 this->RefinmentRatio = r;
70 this->Modified();
71 }
72
74
77 void SetRootSpacing(double h0)
78 {
79 this->RootSpacing[0] = this->RootSpacing[1] = this->RootSpacing[2] = h0;
80 this->Modified();
81 }
82
83
85
88 vtkSetVector3Macro(PulseOrigin, double);
89 vtkGetVector3Macro(PulseOrigin, double);
90 void SetXPulseOrigin(double f)
91 {
92 this->PulseOrigin[0] = f;
93 this->Modified();
94 }
95 void SetYPulseOrigin(double f)
96 {
97 this->PulseOrigin[1] = f;
98 this->Modified();
99 }
100 void SetZPulseOrigin(double f)
101 {
102 this->PulseOrigin[2] = f;
103 this->Modified();
104 }
105
106
108
111 vtkSetVector3Macro(PulseWidth, double);
112 vtkGetVector3Macro(PulseWidth, double);
113 void SetXPulseWidth(double f)
114 {
115 this->PulseWidth[0] = f;
116 this->Modified();
117 }
118 void SetYPulseWidth(double f)
119 {
120 this->PulseWidth[1] = f;
121 this->Modified();
122 }
123 void SetZPulseWidth(double f)
124 {
125 this->PulseWidth[2] = f;
126 this->Modified();
127 }
128
129
131
134 vtkSetMacro(PulseAmplitude, double);
135 vtkGetMacro(PulseAmplitude, double);
137
138protected:
141
147 vtkInformationVector* outputVector) override;
148
150
154 double ComputePulseAt(const double x, const double y, const double z)
155 {
156 double xyz[3];
157 xyz[0] = x;
158 xyz[1] = y;
159 xyz[2] = z;
160 return (this->ComputePulseAt(xyz));
161 }
162 double ComputePulseAt(double pt[3])
163 {
164 double pulse = 0.0;
165 double r = 0.0;
166 for (int i = 0; i < this->Dimension; ++i)
167 {
168 double d = pt[i] - this->PulseOrigin[i];
169 double d2 = d * d;
170 double L2 = this->PulseWidth[i] * this->PulseWidth[i];
171 r += d2 / L2;
172 }
173 pulse = this->PulseAmplitude * std::exp(-r);
174 return (pulse);
175 }
176
177
182 void ComputeCellCenter(vtkUniformGrid* grid, vtkIdType cellIdx, double centroid[3]);
183
188
193 vtkUniformGrid* GetGrid(double origin[3], double h[3], int ndim[3]);
194
198 vtkUniformGrid* RefinePatch(vtkUniformGrid* parent, int patchExtent[6]);
199
201
207
208 double RootSpacing[3];
209 double PulseOrigin[3];
210 double PulseWidth[3];
215
216private:
218 void operator=(const vtkAMRGaussianPulseSource&) = delete;
219};
220
221#endif /* vtkAMRGaussianPulseSource_h */
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
double ComputePulseAt(double pt[3])
Computes the gaussian pulse at the given location based on the user supplied parameters for pulse wid...
vtkUniformGrid * GetGrid(double origin[3], double h[3], int ndim[3])
Constructs a uniform grid path with the given origin/spacing and node dimensions.
void Generate3DDataSet(vtkOverlappingAMR *amr)
Generate 2-D or 3-D DataSet.
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...
vtkUniformGrid * RefinePatch(vtkUniformGrid *parent, int patchExtent[6])
Constructs a refined patch from the given parent grid.
~vtkAMRGaussianPulseSource() override
void SetZPulseWidth(double f)
Set & Get macro for the pulse width.
void SetRootSpacing(double h0)
Set the root spacing.
static vtkAMRGaussianPulseSource * New()
void SetZPulseOrigin(double f)
Set & Get macro for the pulse origin.
void SetYPulseWidth(double f)
Set & Get macro for the pulse width.
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
void SetYPulseOrigin(double f)
Set & Get macro for the pulse origin.
void SetRefinementRatio(int r)
Set the refinement ratio.
void Generate2DDataSet(vtkOverlappingAMR *amr)
Generate 2-D or 3-D DataSet.
void SetXPulseOrigin(double f)
Set & Get macro for the pulse origin.
void GeneratePulseField(vtkUniformGrid *grid)
Generates a pulse field for the given uniform grid.
void SetXPulseWidth(double f)
Set & Get macro for the pulse width.
void ComputeCellCenter(vtkUniformGrid *grid, vtkIdType cellIdx, double centroid[3])
Given the cell index w.r.t.
a simple class to control print indentation
Definition vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
virtual void Modified()
Update the modification time for this object.
hierarchical dataset of vtkUniformGrids
Computes the portion of a dataset which is inside a selection.
image data with blanking
int vtkIdType
Definition vtkType.h:332