22 #include <LbmLib/include/nodes/BoundaryNode.hpp>
23 #include <LbmLib/include/nodes/PhysicalNode.hpp>
24 #include <LbmLib/include/solver/BoundarySolverFactory.hpp>
25 #include <LbmLib/include/solver/BoundaryAbstractSolver.hpp>
38 const std::map<std::string, std::vector<std::string> >& connectionType,
41 physicalNeighbour_(nullptr) {
43 for (
auto solver : connectionType) {
44 this->addBoundarySolver(solver.first);
50 return this->domainId_;
54 for (
const auto& i : boundarySolvers_) {
61 const Direction& dir) {
62 assert(physicalNode !=
nullptr);
63 physicalNeighbour_ = physicalNode;
64 directionToPhysicalNeighbour_ = dir;
68 assert(physicalNeighbour_ == physicalNode);
72 return directionToPhysicalNeighbour_;
76 return physicalNeighbour_;
80 return std::string(
"BoundaryNode");
84 const std::string& name) {
85 auto retVal = boundarySolvers_.find(name);
86 if (retVal == boundarySolvers_.end()) {
87 std::stringstream error;
88 error <<
"The CDE Solver with the name " << name <<
89 " does not exists. You need to add them first\n";
92 return *retVal->second;
97 return boundarySolvers_;
100 void BoundaryNode::addBoundarySolver(
const std::string& name) {
101 if (boundarySolvers_.find(name) != boundarySolvers_.end()) {
102 std::stringstream error;
103 error <<
"The Boundary Solver with the name " << name <<
104 " already exists. You cannot add the same twice\n";
107 boundarySolvers_[name] =
109 boundarySolvers_[name]->connectBoundaryNode(
this);
113 double localId = 10000000.0 *
getXPos() + 10000.0 *
static_cast<double>(
getYPos());
114 (*oStream) << std::setprecision(12) << localId <<
"[pos=\"" <<
getXPos() <<
115 "," <<
getYPos() << std::setprecision(5) <<
116 "!\",shape=triangle, label=\"" <<
getXPos() <<
";" <<
getYPos() <<
119 double nodeId1 = 10000000.0 * physicalNeighbour_->
getXPos() + 10000.0 *
120 static_cast<double>(physicalNeighbour_->
getYPos());
121 (*oStream) << std::setprecision(12) << nodeId1 << std::setprecision(5) <<
122 "[pos=\"" << physicalNeighbour_->
getXPos() <<
"," <<
123 physicalNeighbour_->
getYPos() <<
"!\",shape=circle, label=\"" <<
124 physicalNeighbour_->
getXPos() <<
";" <<
125 physicalNeighbour_->
getYPos() <<
"\"];" << std::endl;
127 (*oStream) << std::setprecision(12) << localId <<
"->" << nodeId1 <<
BoundaryNode(double x, double y, const std::map< std::string, std::vector< std::string > > &connectionType, unsigned int domainId)
BoundaryNode Constructor for a boundary node.
The BoundaryAbstractSolver class The abstract base class for all Boundary Solvers.
double getYPos() const
getYPos Getter for the Y position
std::map< std::string, solver::BoundaryAbstractSolver * > & getBoundarySolvers()
getBoundarySolvers Getter method for all Boundary Solvers
class representing a physical node
void setBoundaryNeighbour(BoundaryNode *const boundaryNode, const Direction &d)
setBoundaryNeighbour Setter for the neighbour boundary point
PhysicalNode * getPhysicalNeighbour() const
getFluidNeighbour Getter for the Physical neighbour
unsigned int getDomainIdentifier() const
getDomainIdentifier Getter for the domain Identifier
void connectToCDESolvers(const std::vector< std::string > &cdeSolvers)
connectToCDESolvers makes sure that this boundary Solver is executed on all connected CDE Solvers ...
~BoundaryNode()
~BoundaryNode Destructor
int getXPos() const
getXPos Getter for the X position
Direction getDirectionToNeighbour() const
getDirectionToNeighbour returns the direction to the next neighbour
BoundaryNode * getBoundaryNeighbour(const Direction &d) const
getBoundaryNeighbour Getter method to access the Boundary Neighbour
virtual std::string getType() const
getType The type of a node class
int getYPos() const
getYPos Getter for the Y position
double getXPos() const
getXPos Getter for the X position
void dumpNode(std::ostream *oStream) const
dumpNode dumps the node for dot
solver::BoundaryAbstractSolver & getBoundarySolver(const std::string &name)
getBoundarySolver Getter method for the boundary Solver
The LagrangianPoint class A class for storing a point's coordinates and its velocity This class is th...
void setPhysicalNeighbours(PhysicalNode *const physicalNode, const Direction &dir)
setPhysicalNeighbours Sets the corresponding Physical neighbours of this node