LBIBCell
 All Classes Functions Variables Friends Pages
AbstractSolver.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 ABSTRACTSOLVER_HPP
23 #define ABSTRACTSOLVER_HPP
24 
25 #include <LbmLib/include/Direction.hpp>
26 #include <string>
27 
28 namespace LbmLib {
29 namespace solver {
34  public:
38  virtual ~AbstractSolver() {}
39 
43  virtual void initSolver() = 0;
44 
48  virtual void collide() = 0;
49 
53  virtual void advect() = 0;
54 
59  virtual void loadSolver(std::stringstream* const stream) = 0;
60 
66  virtual void writeSolver(std::ostream* const stream) = 0;
67 
73  virtual double& accessDistribution(const Direction& dir) = 0;
74 
79  virtual void rescaleDistributions(const double factor) = 0;
80 
85  void setTau(double tau) {
86  tau_ = tau;
87  }
88 
93  double getTau() const {
94  return tau_;
95  }
96 
97  protected:
101  AbstractSolver();
102 
103  private:
107  double tau_;
108 };
109 }
110 } // end namespace
111 
112 #endif // ABSTRACTSOLVER_HPP
the base class of the cde and fluid solvers
virtual void loadSolver(std::stringstream *const stream)=0
loads the solver from the stream
virtual double & accessDistribution(const Direction &dir)=0
accessDistribution Access to the distribution
virtual ~AbstractSolver()
~AbstractSolver Destructor
void setTau(double tau)
setTau Setter method for the tau parameter of the solver
virtual void collide()=0
collide The collision step of the LBM
double getTau() const
getTau Getter method for the tau parameter
AbstractSolver()
AbstractSolver Protected to disable direct instantiation.
virtual void rescaleDistributions(const double factor)=0
Rescales all distributions by a factor.
virtual void initSolver()=0
initSolver Use this to initalise the solver
virtual void advect()=0
advect The advect step of the LBM
virtual void writeSolver(std::ostream *const stream)=0
writes the solver to the stream