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
39class vtkUniformGrid;
40class vtkInformation;
42
43class VTKFILTERSAMR_EXPORT vtkAMRGaussianPulseSource :
45{
46public:
49 void PrintSelf(ostream& os, vtkIndent indent);
50
52
55 vtkSetMacro(Dimension,int);
57
59
62 vtkSetMacro(NumberOfLevels,int);
64
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
118protected:
121
126 virtual int RequestData(vtkInformation *request,
127 vtkInformationVector **inputVector,
128 vtkInformationVector *outputVector);
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
161 vtkIdType cellIdx,
162 double centroid[3] );
163
168
173 vtkUniformGrid* GetGrid( double origin[3], double h[3], int ndim[3] );
174
178 vtkUniformGrid* RefinePatch(vtkUniformGrid* parent, int patchExtent[6]);
179
181
187
188 double RootSpacing[3];
189 double PulseOrigin[3];
190 double PulseWidth[3];
195
196private:
197 vtkAMRGaussianPulseSource(const vtkAMRGaussianPulseSource&) VTK_DELETE_FUNCTION;
198 void operator=(const vtkAMRGaussianPulseSource&) VTK_DELETE_FUNCTION;
199};
200
201#endif /* vtkAMRGaussianPulseSource_h */
A source that generates sample AMR data with gaussian pulse field.
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)
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.
void SetRootSpacing(double h0)
Set the root spacing.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
static vtkAMRGaussianPulseSource * New()
void SetRefinementRatio(int r)
Set the refinement ratio.
void Generate2DDataSet(vtkOverlappingAMR *amr)
Generate 2-D or 3-D DataSet.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
void GeneratePulseField(vtkUniformGrid *grid)
Generates a pulse field for the given uniform grid.
void ComputeCellCenter(vtkUniformGrid *grid, vtkIdType cellIdx, double centroid[3])
Given the cell index w.r.t.
virtual ~vtkAMRGaussianPulseSource()
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.
A base class for all algorithms that take as input vtkOverlappingAMR and produce vtkOverlappingAMR.
hierarchical dataset of vtkUniformGrids
image data with blanking
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
int vtkIdType
Definition: vtkType.h:287