forked from biddisco/pv-meshless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvtkSPHManager.h
196 lines (165 loc) · 6.45 KB
/
vtkSPHManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/*=========================================================================
Project : vtkCSCSMeshless
Module : vtkSPHManager.h
Authors:
John Biddiscombe Jerome Soumagne
Copyright (C) CSCS - Swiss National Supercomputing Centre.
You may use modify and and distribute this code freely providing
1) This copyright notice appears on all copies of source code
2) An acknowledgment appears with any substantial usage of the code
3) If this code is contributed to any other open source project, it
must not be reformatted such that the indentation, bracketing or
overall style is modified significantly.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
=========================================================================*/
// .NAME vtkSPHProbeFilter2 - SPH Convenience Manager Class
// .SECTION Description
#ifndef __vtkSPHManager_h
#define __vtkSPHManager_h
#include "vtkObject.h"
#include "vtkSmartPointer.h" // for smartpointers
//BTX
class Kernel;
//ETX
//
// a 7x7x7 cube will have 343 points which is as many as we expect to ever usefully need.
// this corresponds to a cube made from a point and 3 neighbours in each direction
#define KERNEL_MAX_NEIGHBOURS 350
class VTK_EXPORT vtkSPHManager : public vtkObject
{
public:
static vtkSPHManager *New();
vtkTypeMacro(vtkSPHManager,vtkObject);
//BTX
enum {
POINT_INTERPOLATION_KERNEL=0,
POINT_INTERPOLATION_SHEPARD,
};
//ETX
// Description:
// Use either SPH Kernel interpolation or Linear interpolation
vtkSetMacro(InterpolationMethod, int);
vtkGetMacro(InterpolationMethod, int);
void SetInterpolationMethodToKernel() {
this->SetInterpolationMethod(POINT_INTERPOLATION_KERNEL); }
void SetInterpolationMethodToLinear() {
this->SetInterpolationMethod(POINT_INTERPOLATION_SHEPARD); }
// Description:
// if VolumeScalars are provided (per particle), then the kernel
// summation term m/rho uses the array provided and the parameters
// (DensityScalars, DefaultDensity, MassScalars) are ignored.
vtkSetStringMacro(VolumeScalarsRegex);
vtkGetStringMacro(VolumeScalarsRegex);
// Description:
// For a variable-h simulation, an h-array must be supplied
// this determines the kernel cutoff on a per-particle basis.
vtkSetStringMacro(HScalarsRegex);
vtkGetStringMacro(HScalarsRegex);
// Description:
// The Kernel H Factor with a Default value of 1.5.
// It is also referred to as the LengthRatio and converts the
// side length of a cubic particle of volume v into the h value
// <verbatim>
// h = HCoefficient * DefaultParticleSideLength
// </verbatim>
// the Kernel cutoff is usually 2h (3rd order spline)
// or 3h (5th order spline)
vtkSetMacro(HCoefficient, double);
vtkGetMacro(HCoefficient, double);
// Description:
// The DefaultParticleSideLength is the length (in metres) of 1 side of a cube
// holding the particle at the start of the simulation.
// When using a 3D kernel the volume of a particle will
// be the cube of DefaultParticleSideLength, and this is used to normalize
// the summation of kernel contributions given the density.
// For EDF Test Case 2, DefaultParticleSideLength = 0.01*(55.0/30.0)m
// Where the 0.01 factor converts cm to m.
// The units used must be consistent with the position coordinates
// of the particles (ie metres, cm, etc)
// Default value = 0.0183333333333333333
vtkSetMacro(DefaultParticleSideLength, double);
vtkGetMacro(DefaultParticleSideLength, double);
// Description:
// if each particle has a density value, specify the array name here.
// if not specified then the value of DefaultDensity will be used
vtkSetStringMacro(DensityScalarsRegex);
vtkGetStringMacro(DensityScalarsRegex);
// Description:
// Material density is 1000 (Kg/m^3) by default, but can be changed if
// the simulation requires it, overridden if DensityScalars are supplied.
vtkSetMacro(DefaultDensity, double);
vtkGetMacro(DefaultDensity, double);
// Description:
// if each particle has a mass value, specify the array name here.
// if not specified then the value of mass will be computed from particle size
// and density etc.
vtkSetStringMacro(MassScalarsRegex);
vtkGetStringMacro(MassScalarsRegex);
//BTX
enum {
SPH_KERNEL_GAUSSIAN=0,
SPH_KERNEL_QUADRATIC,
SPH_KERNEL_SPLINE_3RD,
SPH_KERNEL_SPLINE_5TH,
SPH_KERNEL_CUSP,
SPH_KERNEL_BOX,
SPH_KERNEL_WENDLAND,
};
//ETX
// Description:
// Set which kernel is being used, currently the following are supported
// CubicSPline3D, CubicSPline2D, Cusp3D
vtkSetMacro(KernelType, int);
vtkGetMacro(KernelType, int);
void SetKernelTypeToGaussian() {
this->SetKernelType(SPH_KERNEL_GAUSSIAN); }
void SetKernelTypeToWendland() {
this->SetKernelType(SPH_KERNEL_WENDLAND); }
void SetKernelTypeToQuadratic3D() {
this->SetKernelType(SPH_KERNEL_QUADRATIC); }
void SetKernelTypeToCubicSpline() {
this->SetKernelType(SPH_KERNEL_SPLINE_3RD); }
void SetKernelTypeToQuinticSpline() {
this->SetKernelType(SPH_KERNEL_SPLINE_5TH); }
void SetKernelTypeToCusp() {
this->SetKernelType(SPH_KERNEL_CUSP); }
// Description:
// Set the kernel dimension, 2D or 3D are permitted
vtkSetMacro(KernelDimension, int);
vtkGetMacro(KernelDimension, int);
// Description:
// Set the Maximum radius when searching for neighbours
vtkSetMacro(MaximumSearchRadius, double);
vtkGetMacro(MaximumSearchRadius, double);
// Description:
// Set the Maximum number of Neighbours to use in SHEPARD mode
vtkSetMacro(MaximumNeighbours, int);
vtkGetMacro(MaximumNeighbours, int);
protected:
vtkSPHManager();
~vtkSPHManager();
// switch shepard/sph
int InterpolationMethod;
double MaximumSearchRadius;
// Shepard Mode
int MaximumNeighbours;
// SPH Mode
int KernelType;
int KernelDimension;
char *HScalarsRegex;
char *VolumeScalarsRegex;
char *MassScalarsRegex;
char *DensityScalarsRegex;
// SPH Variables
double DefaultParticleSideLength;
double DefaultDensity;
double HCoefficient;
//
static vtkSPHManager *SPHManagerSingleton;
private:
vtkSPHManager(const vtkSPHManager&); // Not implemented.
void operator=(const vtkSPHManager&); // Not implemented.
};
#endif