-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMeshsizeFactory.h
48 lines (40 loc) · 1.38 KB
/
MeshsizeFactory.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
#ifndef _MESHSIZEFACTORY_H_
#define _MESHSIZEFACTORY_H_
#include "Definitions.h"
#include "Parameters.h"
/** initialises the meshsize in the Parameters. Must be called after configuring (Configuration and PetscParallelConfiguration).
* We therefore make use of the singleton/factory pattern.
* @author Philipp Neumann
*/
class MeshsizeFactory {
public:
static MeshsizeFactory& getInstance(){
static MeshsizeFactory singleton;
return singleton;
}
void initMeshsize(Parameters& parameters){
// initialise meshsize
switch (parameters.geometry.meshsizeType){
// uniform meshsize
case Uniform:
parameters.meshsize = new UniformMeshsize(parameters);
break;
// tanh-stretched mesh
case TanhStretching:
parameters.meshsize = new TanhMeshStretching(
parameters,
(bool)parameters.geometry.stretchX,(bool)parameters.geometry.stretchY,(bool)parameters.geometry.stretchZ
);
break;
default:
handleError(1,"Unknown meshsize type!");
break;
}
// check that meshsize is initialised
if (parameters.meshsize==NULL){handleError(1,"parameters.meshsize==NULL!"); }
}
private:
MeshsizeFactory(){}
~MeshsizeFactory(){}
};
#endif // _MESHSIZEFACTORY_H_