forked from biddisco/pv-meshless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvtkSPHManager.cxx
111 lines (102 loc) · 4.29 KB
/
vtkSPHManager.cxx
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
/*=========================================================================
Project : vtkCSCSMeshless
Module : vtkSPHManager.cxx
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
#include "vtkSPHManager.h"
//
#include "vtkObjectFactory.h"
#include "vtkSmartPointer.h"
//
#include "KernelGaussian.h"
#include "KernelWendland.h"
#include "KernelQuadratic.h"
#include "KernelSpline3rdOrder.h"
#include "KernelSpline5thOrder.h"
//
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
extern vtkObject* vtkInstantiatorvtkSPHManagerNew();
vtkSPHManager *vtkSPHManager::SPHManagerSingleton = NULL;
//----------------------------------------------------------------------------
#undef ErrorMacro
#define ErrorMacro(x) \
{ \
if (vtkObject::GetGlobalWarningDisplay()) \
{ \
vtkOStreamWrapper::EndlType endl; \
vtkOStreamWrapper::UseEndl(endl); \
vtkOStrStreamWrapper vtkmsg; \
vtkmsg << "ERROR: In " __FILE__ ", line " << __LINE__ \
<< "\n" x << "\n\n"; \
vtkOutputWindowDisplayErrorText(vtkmsg.str()); \
vtkmsg.rdbuf()->freeze(0); vtkObject::BreakOnError(); \
} \
}
//----------------------------------------------------------------------------
vtkSPHManager *vtkSPHManager::New()
{
if (vtkSPHManager::SPHManagerSingleton) {
// increase the reference count
vtkSPHManager::SPHManagerSingleton->Register(NULL);
return vtkSPHManager::SPHManagerSingleton;
}
//
vtkSPHManager *temp = new vtkSPHManager();
if (temp!=vtkSPHManager::SPHManagerSingleton) {
ErrorMacro(<<"A serious (probably thread related error) has occured in vtkSPHManager singleton creation")
}
return vtkSPHManager::SPHManagerSingleton;
}
//----------------------------------------------------------------------------
vtkObject *vtkInstantiatorvtkSPHManagerNew()
{
return vtkSPHManager::New();
}
//----------------------------------------------------------------------------
// Singleton creation, not really thread-safe, but unlikely to ever be tested
vtkSPHManager::vtkSPHManager()
{
if (vtkSPHManager::SPHManagerSingleton==NULL) {
vtkSPHManager::SPHManagerSingleton = this;
}
// switch shepard/sph
this->InterpolationMethod = POINT_INTERPOLATION_KERNEL;
this->MaximumSearchRadius = 0.0;
// Shepard Mode
this->MaximumNeighbours = 32;
// SPH Mode
this->KernelType = SPH_KERNEL_SPLINE_3RD;
this->KernelDimension = 3;
this->HScalarsRegex = NULL;
this->VolumeScalarsRegex = NULL;
this->MassScalarsRegex = NULL;
this->DensityScalarsRegex = NULL;
// SPH Variables
this->DefaultParticleSideLength = 0.18333;
this->DefaultDensity = 1000.0;
this->HCoefficient = 1.5;
}
//----------------------------------------------------------------------------
vtkSPHManager::~vtkSPHManager()
{
this->SetHScalarsRegex(NULL);
this->SetVolumeScalarsRegex(NULL);
this->SetMassScalarsRegex(NULL);
this->SetDensityScalarsRegex(NULL);
vtkSPHManager::SPHManagerSingleton=NULL;
}
//----------------------------------------------------------------------------