DamBreak++ Wave Simulator 0.3
DamBreak++ Simulation Framework
Loading...
Searching...
No Matches
dbpp_PhysicalAlgorithmFactory.hpp
Go to the documentation of this file.
1#pragma once
2
3// C++ include
4#include "../../include/Sfx_Simulation.h"
5#include "../../SfxBase/Sfx_PhysicalAlgorithm.h"
6#include "../PhysicsAlgorithm/Testvs19_EMcNeilAlgorithm.h"
7#include "../PhysicsAlgorithm/Testvs19_ProtoPhysicalAlgorithm.h"
8#include "../PhysicsAlgorithm/Testvs19_BaseRhsPhysicsAlgorithm.h"
9
10namespace dbpp
11{
12 inline constexpr std::string toStr(std::string aStr)
13 {
14 return aStr; //std::string{ "EMcNeilAlgorithm" };
15 }
16
23 template<typename... Ts >
24 std::unique_ptr<Sfx::PhysicalAlgorithm> makeSfxPhysicalAlgorithm( Ts&&... params)
25 {
26 using namespace std::string_literals;
27 using namespace std::string_view_literals;
28
29 //static_assert( std::is_same_v<name, std::string>);
30
31 constexpr std::string_view w_algoName = "EMcNeilAlgorithm"sv;
32
33 std::unique_ptr<Sfx::PhysicalAlgorithm> ptrPhyAlgo{nullptr};
34
35 if constexpr (toStr("EMcNeilAlgorithm") == "EMcNeilAlgorithm"s)
36 {
37 ptrPhyAlgo.reset( new Testvs19::EMcNeilAlgorithm( std::forward<Ts>(params)...));
38 }
39 else if constexpr (sizeof...(params) == 3)
40 {
41 ptrPhyAlgo.reset( new Testvs19::BaseRhsPhysicsAlgorithm( std::forward<Ts>(params)...));
42 }
43 else if constexpr (sizeof...(params) == 2)
44 {
45 ptrPhyAlgo.reset( new Testvs19::ProtoPhysicalAlgorithm( std::forward<Ts>(params)...));
46 }
47 else // not supported
48 {
49 Sfx::Logger::instance()->OutputError(std::string{"Physical Algorithm not supported"}.data());
50 return nullptr;
51 }
52 return ptrPhyAlgo; // NRVO (move return value)
53 }
54}// End of namespace
Base RHS terms algoritm (support legacy code).
Definition Testvs19_BaseRhsPhysicsAlgorithm.h:24
Concept of physical algoritm using components (set numerical method). This allow to program complex a...
Definition Testvs19_EMcNeilAlgorithm.h:30
Concept of physical algoritm using components (set numerical method). This allow to program complex a...
Definition Testvs19_ProtoPhysicalAlgorithm.h:37
Definition DamBreakProb.h:15
constexpr std::string toStr(std::string aStr)
Definition dbpp_PhysicalAlgorithmFactory.hpp:12
std::unique_ptr< Sfx::PhysicalAlgorithm > makeSfxPhysicalAlgorithm(Ts &&... params)
factory method to create physical algorithm
Definition dbpp_PhysicalAlgorithmFactory.hpp:24