36 #ifndef ABSTRACTBOUNDARYCONDITIONSCONTAINERIMPLEMENTATION_HPP_
37 #define ABSTRACTBOUNDARYCONDITIONSCONTAINERIMPLEMENTATION_HPP_
39 #include "AbstractBoundaryConditionsContainer.hpp"
42 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM,
unsigned PROBLEM_DIM>
44 : mHasDirichletBCs(false),
45 mCheckedAndCommunicatedIfDirichletBcs(false),
46 mDeleteConditions(deleteConditions)
48 for (
unsigned index_of_unknown=0; index_of_unknown<PROBLEM_DIM; index_of_unknown++)
54 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM,
unsigned PROBLEM_DIM>
57 DeleteDirichletBoundaryConditions();
60 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM,
unsigned PROBLEM_DIM>
63 if (!mCheckedAndCommunicatedIfDirichletBcs)
65 bool i_have_dirichlet=
false;
66 for (
unsigned i=0; i<PROBLEM_DIM; i++)
68 if (!mpDirichletMap[i]->empty())
70 i_have_dirichlet=
true;
75 mCheckedAndCommunicatedIfDirichletBcs =
true;
77 return mHasDirichletBCs;
80 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM,
unsigned PROBLEM_DIM>
83 for (
unsigned i=0; i<PROBLEM_DIM; i++)
85 if (mpDirichletMap[i])
87 mDirichIterator = mpDirichletMap[i]->begin();
88 while (mDirichIterator != mpDirichletMap[i]->end() )
90 if (alreadyDeletedConditions.count(mDirichIterator->second) == 0)
92 alreadyDeletedConditions.insert(mDirichIterator->second);
93 if (mDeleteConditions)
95 delete mDirichIterator->second;
101 delete(mpDirichletMap[i]);
102 mpDirichletMap[i] =
nullptr;
107 ResetDirichletCommunication();
110 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM,
unsigned PROBLEM_DIM>
113 assert(indexOfUnknown < PROBLEM_DIM);
116 mDirichIterator = mpDirichletMap[indexOfUnknown]->find(pBoundaryNode);
117 assert(mDirichIterator != mpDirichletMap[indexOfUnknown]->end());
119 return mDirichIterator->second->GetValue(pBoundaryNode->
GetPoint());
122 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM,
unsigned PROBLEM_DIM>
125 assert(indexOfUnknown < PROBLEM_DIM);
127 this->mDirichIterator = this->mpDirichletMap[indexOfUnknown]->find(pNode);
129 return (this->mDirichIterator != this->mpDirichletMap[indexOfUnknown]->end());
AbstractBoundaryConditionsContainer(bool deleteConditions=true)
bool HasDirichletBoundaryConditions()
bool HasDirichletBoundaryCondition(const Node< SPACE_DIM > *pNode, unsigned indexOfUnknown=0)
double GetDirichletBCValue(const Node< SPACE_DIM > *pBoundaryNode, unsigned indexOfUnknown=0)
DirichletMapType * mpDirichletMap[PROBLEM_DIM]
~AbstractBoundaryConditionsContainer()
ChastePoint< SPACE_DIM > GetPoint() const
void DeleteDirichletBoundaryConditions(std::set< const AbstractBoundaryCondition< SPACE_DIM > * > alreadyDeletedConditions=std::set< const AbstractBoundaryCondition< SPACE_DIM > * >())