LBIBCell
 All Classes Functions Variables Friends Pages
Connection.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 GEOMETRY_CONNECTION_HPP
23 #define GEOMETRY_CONNECTION_HPP
24 #include <LbmLib/include/Direction.hpp>
25 #include <LbmLib/include/Field.hpp>
26 #include <list>
27 #include <map>
28 #include <memory>
29 #include <string>
30 #include <utility>
31 #include <vector>
32 #include <iostream>
33 #include <unordered_set>
34 
35 namespace LbmLib {
36 namespace nodes {
37 class GeometryNode;
38 class PhysicalNode;
39 class BoundaryNode;
40 class LagrangianPoint;
41 }
42 
43 namespace geometry {
47 class Connection {
48  public:
57  explicit Connection(
58  std::shared_ptr<nodes::GeometryNode> const p1,
59  std::shared_ptr<nodes::GeometryNode> const p2,
60  const std::map<std::string,
61  std::vector<std::string> > connectionType,
62  unsigned int domainId);
66  ~Connection();
67 
72  void writeConnection(std::ofstream* const stream);
73 
80  const std::vector<std::vector<nodes::PhysicalNode*> >& physicalNode,
81  std::unordered_set<nodes::BoundaryNode*>& boundaryNodes);
82 
87  std::pair<std::shared_ptr<nodes::GeometryNode> const,
88  std::shared_ptr<nodes::GeometryNode> const> getGeometryNodes()
89  const;
90 
94  void perturbConnection();
95 
100  double getLength() const;
101 
106  unsigned int getDomainIdentifier() const;
107 
112  const std::map<std::string, std::vector<std::string> > getBoundaryConditionDescriptor() const;
113 
119  void setDomainIdentifier(const unsigned int domainIdentifier);
120 
121  private:
129  void insertBoundaryNode(
130  nodes::BoundaryNode* const newBN,
131  nodes::PhysicalNode* const physicalNode,
132  const Direction& d,
133  std::unordered_set<nodes::BoundaryNode*>& boundaryNodes);
134 
140  Field<double> calculateVelocity(const nodes::BoundaryNode& bnode);
141 
145  const std::pair<std::shared_ptr<nodes::GeometryNode> const,
146  std::shared_ptr<nodes::GeometryNode> const> points_;
150  const std::map<std::string, std::vector<std::string> > connectionType_;
154  unsigned int domainIdentifier_;
155 };
156 } // end namespace
157 } // end namespace
158 #endif // GEOMETRY_CONNECTION_HPP
void setDomainIdentifier(const unsigned int domainIdentifier)
Setter for the domainIdentifier_.
Definition: Connection.cpp:404
void writeConnection(std::ofstream *const stream)
writes the connection ot the stream
Definition: Connection.cpp:170
All PhysicalNodes on the left of the connection are defined as inside.
Definition: Connection.hpp:47
const std::map< std::string, std::vector< std::string > > getBoundaryConditionDescriptor() const
Getter for the boundary condition descriptor.
Definition: Connection.cpp:400
unsigned int getDomainIdentifier() const
Getter for the domainID on the left side of this connection.
Definition: Connection.cpp:396
void perturbConnection()
perturbConnection makes sure that the connection has a slope not near to 0 or infinitive ...
Definition: Connection.cpp:332
class representing a physical node
~Connection()
~Connection non-virutal Destructor
Definition: Connection.cpp:63
double getLength() const
Compute the length of the connection.
Definition: Connection.cpp:389
Connection(std::shared_ptr< nodes::GeometryNode > const p1, std::shared_ptr< nodes::GeometryNode > const p2, const std::map< std::string, std::vector< std::string > > connectionType, unsigned int domainId)
Connection A simple connection connecting two geometry nodes.
Definition: Connection.cpp:51
std::pair< std::shared_ptr< nodes::GeometryNode > const, std::shared_ptr< nodes::GeometryNode > const > getGeometryNodes() const
getGeometryNodes Getter method for the geometry nodes defining this connection
Definition: Connection.cpp:328
class representing a boundary node
void generateBoundaryNodes(const std::vector< std::vector< nodes::PhysicalNode * > > &physicalNode, std::unordered_set< nodes::BoundaryNode * > &boundaryNodes)
generateBoundaryNodes Calculates all possible boundary points defined by this connection, generates and connects them accordingly
Definition: Connection.cpp:224