OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
SolverSettings.h
Go to the documentation of this file.
1#pragma once
5
6#include <string>
8{
9public:
12 std::map<Alignment, std::string> alignmentName{ {CacheLine64,"None" }, {AVX, "AVX"}, {AVX2, "AVX2"}, {AVX512, "AVX512"} };
13
15
16 SolverSettings(bool debug, std::string dimension, std::string meshName, int timeSteps, std::string volumeSelection)
17 : _debug(debug), _dimension(dimension), _meshName(meshName), _timeSteps(timeSteps),_volumeSelection(volumeSelection)
18 {
19 auto system = SystemProperties::GetInstance();
20 if (system.CPUSupportsAVX512())
21 {
22 _activeAlignment= AVX512; //ToDo: Property for it
23 }
24 else if(system.CPUSupportsAVX2())
25 {
26 _activeAlignment = AVX2;
27 }
28 else
29 {
30 _activeAlignment = CacheLine64;
31 }
32 };
33
34 const bool GetDebug(void) const { return _debug; }
35 const std::string GetMeshName(void) const { return _meshName; }
36 const Alignment GetAlignment(void) const { return _activeAlignment; }
37 const int GetSimulationSteps(void) const { return _timeSteps; }
38 void SetActiveNumberOfThreads(int threads) { _activeThreads = threads; }
39
40
41
42 std::string Print()
43 {
44 std::string settings =
45 "Running solver version " + SolverVersion + " with solver settings: \n"
46 "Calculating " + std::to_string(_timeSteps) + " time steps. \n" +
47 "Vectorization: " + alignmentName[_activeAlignment] + "\n" +
48 "Active threads: " + std::to_string(_activeThreads) + "\n";
49
50 return settings;
51 }
52
53private:
54 bool _debug;
55 std::string _dimension;
56 std::string _meshName;
57 int _timeSteps;
58 std::string _volumeSelection;
59
60 int _activeThreads;
61 Alignment _activeAlignment;
62};
63
Alignment
Definition Allignments.h:3
@ AVX
Definition Allignments.h:3
@ AVX2
Definition Allignments.h:3
@ AVX512
Definition Allignments.h:3
@ CacheLine64
Definition Allignments.h:3
static const std::string SolverVersion
Definition SolverVersion.h:14
Definition SolverSettings.h:8
std::string Print()
Definition SolverSettings.h:42
const Alignment GetAlignment(void) const
Definition SolverSettings.h:36
SolverSettings(bool debug, std::string dimension, std::string meshName, int timeSteps, std::string volumeSelection)
Definition SolverSettings.h:16
void SetActiveNumberOfThreads(int threads)
Definition SolverSettings.h:38
Dimension
Definition SolverSettings.h:10
@ UNKOWN
Definition SolverSettings.h:10
@ D3
Definition SolverSettings.h:10
const int GetSimulationSteps(void) const
Definition SolverSettings.h:37
VolumeSelection
Definition SolverSettings.h:11
@ UNKNOWN
Definition SolverSettings.h:11
@ Full
Definition SolverSettings.h:11
SolverSettings()
Definition SolverSettings.h:14
std::map< Alignment, std::string > alignmentName
Definition SolverSettings.h:12
const bool GetDebug(void) const
Definition SolverSettings.h:34
const std::string GetMeshName(void) const
Definition SolverSettings.h:35
static const SystemProperties & GetInstance()
Definition SystemProperties.h:28