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  =========================================================================*/
29 #ifndef VTKAMRGAUSSIANPULSESOURCE_H_
30 #define VTKAMRGAUSSIANPULSESOURCE_H_
31 
32 #include "vtkFiltersAMRModule.h" // For export macro
34 
35 #include <cmath> // For std::exp
36 
37 class vtkOverlappingAMR;
38 class vtkUniformGrid;
39 class vtkInformation;
41 
44 {
45 public:
48  void PrintSelf(ostream& os, vtkIndent indent);
49 
51 
52  vtkSetMacro(Dimension,int);
54 
56 
57  vtkSetMacro(NumberOfLevels,int);
59 
61 
62  void SetRefinementRatio(int r)
63  {this->RefinmentRatio=r;this->Modified();}
65 
67 
68  void SetRootSpacing(double h0)
69  {
70  this->RootSpacing[0]=this->RootSpacing[1]=this->RootSpacing[2]=h0;
71  this->Modified();
72  }
74 
76 
77  vtkSetVector3Macro(PulseOrigin,double);
78  vtkGetVector3Macro(PulseOrigin,double);
79  void SetXPulseOrigin(double f)
80  {this->PulseOrigin[0]=f;this->Modified();}
81  void SetYPulseOrigin(double f)
82  {this->PulseOrigin[1]=f;this->Modified();}
83  void SetZPulseOrigin(double f)
84  {this->PulseOrigin[2]=f;this->Modified();}
86 
88 
89  vtkSetVector3Macro(PulseWidth,double);
90  vtkGetVector3Macro(PulseWidth,double);
91  void SetXPulseWidth(double f)
92  {this->PulseWidth[0]=f;this->Modified();}
93  void SetYPulseWidth(double f)
94  {this->PulseWidth[1]=f;this->Modified();}
95  void SetZPulseWidth(double f)
96  {this->PulseWidth[2]=f;this->Modified();}
98 
100 
101  vtkSetMacro(PulseAmplitude,double);
102  vtkGetMacro(PulseAmplitude,double);
104 
105 protected:
107  virtual ~vtkAMRGaussianPulseSource();
108 
110 
112  virtual int RequestData(vtkInformation *request,
113  vtkInformationVector **inputVector,
114  vtkInformationVector *outputVector);
116 
118 
120  double ComputePulseAt(const double x, const double y, const double z)
121  {
122  double xyz[3]; xyz[0]=x; xyz[1]=y; xyz[2]=z;
123  return( this->ComputePulseAt(xyz) );
124  }
125  double ComputePulseAt( double pt[3] )
126  {
127  double pulse = 0.0;
128  double r = 0.0;
129  for( int i=0; i < this->Dimension; ++i )
130  {
131  double d = pt[i]-this->PulseOrigin[i];
132  double d2 = d*d;
133  double L2 = this->PulseWidth[i]*this->PulseWidth[i];
134  r += d2/L2;
135  }
136  pulse = this->PulseAmplitude*std::exp( -r );
137  return( pulse );
138  }
140 
142 
144  void ComputeCellCenter(vtkUniformGrid *grid,
145  vtkIdType cellIdx,
146  double centroid[3] );
148 
150  void GeneratePulseField(vtkUniformGrid *grid);
151 
154  vtkUniformGrid* GetGrid( double origin[3], double h[3], int ndim[3] );
155 
157  vtkUniformGrid* RefinePatch(vtkUniformGrid* parent, int patchExtent[6]);
158 
160 
161  void Generate2DDataSet(vtkOverlappingAMR* amr);
162  void Generate3DDataSet(vtkOverlappingAMR* amr);
164 
165  double RootSpacing[3];
166  double PulseOrigin[3];
167  double PulseWidth[3];
172 
173 private:
174  vtkAMRGaussianPulseSource(const vtkAMRGaussianPulseSource&); // Not implemented
175  void operator=(const vtkAMRGaussianPulseSource&); // Not implemented
176 };
177 
178 #endif /* VTKAMRGAUSSIANPULSESOURCE_H_ */
void PrintSelf(ostream &os, vtkIndent indent)
Store vtkAlgorithm input/output information.
#define VTKFILTERSAMR_EXPORT
int vtkIdType
Definition: vtkType.h:275
double ComputePulseAt(const double x, const double y, const double z)
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual void Modified()
image data with blanking
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
hierarchical dataset of vtkUniformGrids
Store zero or more vtkInformation instances.
static vtkOverlappingAMRAlgorithm * New()