LBIBCell
 All Classes Functions Variables Friends Pages
ForceSolver.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 FORCESOLVER_HPP
23 #define FORCESOLVER_HPP
24 
25 #include <LbmLib/include/solver/AbstractForceStruct.hpp>
26 #include <map>
27 #include <memory>
28 #include <string>
29 #include <vector>
30 
31 namespace LbmLib {
32 namespace nodes {
33 class GeometryNode;
34 }
35 
36 namespace solver {
37 typedef std::shared_ptr< AbstractForceStruct> shptr_forcestruct;
38 typedef std::vector< shptr_forcestruct > vec_shptr_forcestruct;
39 typedef std::map< unsigned int, vec_shptr_forcestruct > map_forcestruct;
43 class ForceSolver {
44  public:
49  void calculateForce(const std::map<unsigned int,
50  std::shared_ptr<nodes::GeometryNode> >& nodes);
51 
55  ForceSolver();
56 
61  void loadForceFile(const std::string& filename);
62 
67  void addForce(std::stringstream* const forcedescriptor);
68 
73  void writeForceSolver(const std::string& filename) const;
74 
78  void deleteAllForces();
79 
84  void deleteForceType(const unsigned int forcetype);
85 
92  vec_shptr_forcestruct getForcesOfNode(vec_shptr_forcestruct &forcevector,
93  const unsigned int nodeid);
94 
99  const map_forcestruct getAllForces() const;
100 
101 
105  ~ForceSolver();
106 
107  private:
111  vec_shptr_forcestruct forces_;
112 
116  map_forcestruct forcemap_;
117 };
118 }
119 } // end namespace
120 
121 #endif // FORCESOLVER_HPP
void deleteForceType(const unsigned int forcetype)
reset all forces
The actual force solver.
Definition: ForceSolver.hpp:43
~ForceSolver()
The destructor.
Definition: ForceSolver.cpp:87
vec_shptr_forcestruct getForcesOfNode(vec_shptr_forcestruct &forcevector, const unsigned int nodeid)
get all forces of nodeid
ForceSolver()
The constructor.
Definition: ForceSolver.cpp:39
void writeForceSolver(const std::string &filename) const
writes the forces to the file
void addForce(std::stringstream *const forcedescriptor)
add a force
const map_forcestruct getAllForces() const
getAllForces returns the entire map {nodeid, AbstractForceStruct}
void loadForceFile(const std::string &filename)
loading of the force solver
Definition: ForceSolver.cpp:89
void deleteAllForces()
reset all forces
void calculateForce(const std::map< unsigned int, std::shared_ptr< nodes::GeometryNode > > &nodes)
calculates the Force
Definition: ForceSolver.cpp:42