-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSimulationFactory.cpp
54 lines (37 loc) · 1.56 KB
/
SimulationFactory.cpp
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
#include "SimulationFactory.h"
#include "Simulation.h"
#include "TurbulentSimulation.h"
#include "TurbulentKepsSimulation.h"
#include "FlowField.h"
#include "TurbulentFlowField.h"
SimulationFactory::SimulationFactory(Parameters ¶meters) {
if(parameters.simulation.type == "turbulence") {
_flowField = new TurbulentFlowField(parameters);
if(parameters.turbulence.model == "mixingLength") {
_simulation = new TurbulentSimulation(parameters, *static_cast<TurbulentFlowField*>(_flowField));
} else if(parameters.turbulence.model == "keps") {
_simulation = new TurbulentKepsSimulation(parameters, *static_cast<TurbulentFlowField*>(_flowField));
} else {
handleError(1, "Unknown turbulence model");
}
} else if(parameters.simulation.type == "dns") {
_flowField = new FlowField(parameters);
_simulation = new Simulation(parameters, *_flowField);
} else {
handleError(1, "Unknown simulation type! Currently supported: dns, turbulence");
}
if(parameters.parallel.rank == 0) {
std::cout << "==================================================================" << std::endl;
std::cout << "Starting simulation" << std::endl;
std::cout << "Dimensions: " << parameters.geometry.dim << std::endl;
std::cout << "Type: " << parameters.simulation.type << std::endl;
std::cout << "==================================================================" << std::endl;
}
}
SimulationFactory::~SimulationFactory() {
delete _flowField;
delete _simulation;
}
Simulation * SimulationFactory::getSimulation() {
return _simulation;
}