VTK  9.1.0
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
36class vtkUniformGrid;
37class vtkInformation;
39
40class VTKFILTERSAMR_EXPORT vtkAMRGaussianPulseSource : public vtkOverlappingAMRAlgorithm
41{
42public:
45 void PrintSelf(ostream& os, vtkIndent indent) override;
46
48
51 vtkSetMacro(Dimension, int);
53
55
58 vtkSetMacro(NumberOfLevels, int);
60
65 {
66 this->RefinmentRatio = r;
67 this->Modified();
68 }
69
71
74 void SetRootSpacing(double h0)
75 {
76 this->RootSpacing[0] = this->RootSpacing[1] = this->RootSpacing[2] = h0;
77 this->Modified();
78 }
80
82
85 vtkSetVector3Macro(PulseOrigin, double);
86 vtkGetVector3Macro(PulseOrigin, double);
87 void SetXPulseOrigin(double f)
88 {
89 this->PulseOrigin[0] = f;
90 this->Modified();
91 }
92 void SetYPulseOrigin(double f)
93 {
94 this->PulseOrigin[1] = f;
95 this->Modified();
96 }
97 void SetZPulseOrigin(double f)
98 {
99 this->PulseOrigin[2] = f;
100 this->Modified();
101 }
103
105
108 vtkSetVector3Macro(PulseWidth, double);
109 vtkGetVector3Macro(PulseWidth, double);
110 void SetXPulseWidth(double f)
111 {
112 this->PulseWidth[0] = f;
113 this->Modified();
114 }
115 void SetYPulseWidth(double f)
116 {
117 this->PulseWidth[1] = f;
118 this->Modified();
119 }
120 void SetZPulseWidth(double f)
121 {
122 this->PulseWidth[2] = f;
123 this->Modified();
124 }
126
128
131 vtkSetMacro(PulseAmplitude, double);
132 vtkGetMacro(PulseAmplitude, double);
134
135protected:
138
144 vtkInformationVector* outputVector) override;
145
147
151 double ComputePulseAt(const double x, const double y, const double z)
152 {
153 double xyz[3];
154 xyz[0] = x;
155 xyz[1] = y;
156 xyz[2] = z;
157 return (this->ComputePulseAt(xyz));
158 }
159 double ComputePulseAt(double pt[3])
160 {
161 double pulse = 0.0;
162 double r = 0.0;
163 for (int i = 0; i < this->Dimension; ++i)
164 {
165 double d = pt[i] - this->PulseOrigin[i];
166 double d2 = d * d;
167 double L2 = this->PulseWidth[i] * this->PulseWidth[i];
168 r += d2 / L2;
169 }
170 pulse = this->PulseAmplitude * std::exp(-r);
171 return (pulse);
172 }
174
179 void ComputeCellCenter(vtkUniformGrid* grid, vtkIdType cellIdx, double centroid[3]);
180
185
190 vtkUniformGrid* GetGrid(double origin[3], double h[3], int ndim[3]);
191
195 vtkUniformGrid* RefinePatch(vtkUniformGrid* parent, int patchExtent[6]);
196
198
204
205 double RootSpacing[3];
206 double PulseOrigin[3];
207 double PulseWidth[3];
212
213private:
215 void operator=(const vtkAMRGaussianPulseSource&) = delete;
216};
217
218#endif /* vtkAMRGaussianPulseSource_h */
A source that generates sample AMR data with gaussian pulse field.
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.
vtkFrustumSelector is a vtkSelector that selects elements based on whether they are inside or interse...
a simple class to control print indentation
Definition: vtkIndent.h:113
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
virtual void Modified()
Update the modification time for this object.
A base class for all algorithms that take as input vtkOverlappingAMR and produce vtkOverlappingAMR.
hierarchical dataset of vtkUniformGrids
image data with blanking
int vtkIdType
Definition: vtkType.h:332