LBIBCell
 All Classes Functions Variables Friends Pages
BioBaseSolver.hpp
1 /* Copyright (c) 2013 David Sichau <mail"at"sichau"dot"eu>
2  * 2013-2015 Simon Tanaka <tanakas"at"gmx"dot"ch>
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20  * THE SOFTWARE.
21  */
22 #ifndef BIOBASESOLVER_HPP
23 #define BIOBASESOLVER_HPP
24 #include <LbmLib/include/solver/BioSolver/BioSolverFactory.hpp>
25 #include <LbmLib/include/solver/BioSolver/BioAbstractSolver.hpp>
26 #include <array>
27 #include <string>
28 #include <vector>
29 
30 namespace LbmLib {
31 namespace nodes {
32 class PhysicalNode;
33 }
34 namespace solver {
45 template <class T>
47  public:
52  std::string getName() {
53  return T::name;
54  }
55 
56  protected:
61  reg = reg; // force specialization
62  }
63 
67  virtual ~BioBaseSolver() {}
68 
77  return new T;
78  }
79 
83  static bool reg;
84 
89  static bool init() {
90  return BioSolverFactory::instance().registerType(T::name,
92  }
93 };
94 
95 template <class T>
96 bool BioBaseSolver<T>::reg = BioBaseSolver<T>::init();
97 }
98 } // end namespace
99 
100 #endif // BIOBASESOLVER_HPP
101 
virtual ~BioBaseSolver()
Virtual destructor.
BioBaseSolver()
The Constructor which enforces specialization.
The MassAbstractSolver class The abstract base class for all Mass Solvers.
static bool init()
init Registers the class in the Solver Factory
static T & instance()
Definition: Singleton.hpp:90
The Base class for all BioSolver implementations. This classes uses the recursive template idiom to a...
static BioAbstractSolver * create()
Static constructor. A pointer to this function along with the name of the algorithm is registered in ...
std::string getName()
getName
static bool reg
reg True if registration was successful.