42 #include <lifev/core/fem/BCBase.hpp> 175 void addBC (
const std::string& name,
191 void addBC (
const std::string& name,
207 void addBC (
const std::string& name,
212 const UInt& numberOfComponents );
224 void addBC (
const std::string& name,
240 void addBC (
const std::string& name,
256 void addBC (
const std::string& name,
272 void addBC (
const std::string& name,
291 void modifyBC ( std::string
const& name,
BCFunctionBase const& bcFunction );
298 void modifyBC ( std::string
const& name,
BCVectorBase const& bcVector );
305 void modifyBC ( std::string
const& name,
BCFunctionUDepBase const& bcFunctionFEVectorDependent );
354 template <
typename Mesh>
368 void showMe (
bool verbose =
false, std::ostream& out = std::cout )
const;
387 void setOffset (
const std::string& name,
Int offset );
456 return M_bcList.begin();
460 return M_bcList.begin();
470 return M_bcList.end();
474 return M_bcList.end();
484 return M_bcList.size();
494 return M_bcList.empty();
525 BCBase* findBC (
const std::string& name );
558 template <
typename Mesh>
562 typedef typename Mesh::elementShape_Type geoShape_Type;
563 typedef typename geoShape_Type::GeoBShape geoBShape_Type;
567 UInt nBElemVertices = geoBShape_Type::S_numVertices;
570 UInt nBElemEdges = geoBShape_Type::S_numEdges;
585 std::set<bcFlag_Type> notFoundMarkers;
587 bool marker_found (
false);
593 beginEssential = M_bcList.begin();
594 while ( (beginEssential != M_bcList.end() ) && (beginEssential->type() < Essential) )
599 beginEssEdges = beginEssential;
600 while ( (beginEssEdges != M_bcList.end() ) && (beginEssEdges->type() < EssentialEdges) )
605 beginEssVertices = beginEssEdges;
606 while ( (beginEssVertices != M_bcList.end() ) && (beginEssVertices->type() < EssentialVertices) )
614 for (
ID iBoundaryElement = 0 ; iBoundaryElement < mesh.numBoundaryFacets(); ++iBoundaryElement )
621 elementMarker = mesh.boundaryFacet ( iBoundaryElement ).markerID();
625 std::vector<ID> localToGlobalMapOnBElem = dof.localToGlobalMapOnBdFacet (iBoundaryElement);
633 marker_found =
false;
634 bcBaseIterator = M_bcList.begin();
635 while ( ( bcBaseIterator = std::find ( bcBaseIterator, beginEssEdges, elementMarker ) ) != beginEssEdges )
638 switch ( bcBaseIterator->type() )
640 case EssentialVertices:
642 ERROR_MSG (
"EssentialVertices and EssentialEdges types should not be prescribed on face labels");
646 for (ID lDof = 0; lDof < localToGlobalMapOnBElem.size(); lDof++)
648 ID gDof = localToGlobalMapOnBElem[ lDof];
651 if ( bcBaseIterator->isDataAVector() )
653 bcBaseIterator->addBCIdentifier (
new BCIdentifierBase ( gDof) );
658 boundaryFE.coorMap ( x, y, z, boundaryFE.refFE().xi ( lDof ), boundaryFE.refFE().eta ( lDof ) );
659 bcBaseIterator->addBCIdentifier (
new BCIdentifierEssential ( gDof, x, y, z ) );
666 if ( bcBaseIterator->isDataAVector() )
669 UInt type = bcBaseIterator->pointerToBCVector()->type() ;
672 for (ID lDof = 0; lDof < localToGlobalMapOnBElem.size(); lDof++)
674 bcBaseIterator->addBCIdentifier (
new BCIdentifierNatural ( localToGlobalMapOnBElem[lDof] ) );
677 else if ( type <= 3 )
679 bcBaseIterator->addBCIdentifier (
new BCIdentifierNatural ( iBoundaryElement, localToGlobalMapOnBElem ) );
683 ERROR_MSG (
"This BCVector type is not yet implemented" );
688 bcBaseIterator->addBCIdentifier (
new BCIdentifierNatural ( iBoundaryElement, localToGlobalMapOnBElem) );
694 bcBaseIterator->addBCIdentifier (
new BCIdentifierNatural ( iBoundaryElement, localToGlobalMapOnBElem ) );
698 if ( bcBaseIterator->isDataAVector() )
700 bcBaseIterator->addBCIdentifier (
new BCIdentifierNatural ( iBoundaryElement, localToGlobalMapOnBElem ) );
705 bcBaseIterator->addBCIdentifier (
new BCIdentifierNatural ( iBoundaryElement, localToGlobalMapOnBElem ) );
717 notFoundMarkers.insert (elementMarker);
726 if ( (beginEssEdges != beginEssVertices) && (nDofPerVert || nDofPerEdge) )
728 ID iAdjacentElem = mesh.boundaryFacet ( iBoundaryElement ).firstAdjacentElementIdentity();
729 ID iElemBElement = mesh.boundaryFacet ( iBoundaryElement ).firstAdjacentElementPosition();
732 for (
ID iBElemEdge = 0; iBElemEdge < nBElemEdges; ++iBElemEdge )
735 ID iElemEdge = geoShape_Type::faceToEdge ( iElemBElement, iBElemEdge ).first;
738 marker = mesh.boundaryEdge ( mesh.localEdgeId ( iAdjacentElem, iElemEdge ) ).markerID();
741 UInt iEdgeFirstVert = geoBShape_Type::edgeToPoint ( iBElemEdge, 0);
742 UInt iEdgeSecondVert = geoBShape_Type::edgeToPoint ( iBElemEdge, 1);
745 bcBaseIterator = beginEssEdges;
746 while ( ( bcBaseIterator = std::find ( bcBaseIterator, beginEssVertices, marker ) ) != beginEssVertices )
749 std::vector<ID> vecEdgeDofs (nDofPerEdge + 2 * nDofPerVert);
751 ID iTotalEdgeDof = 0;
754 for ( ID iVertexDof = 0; iVertexDof < nDofPerVert; ++iVertexDof )
756 vecEdgeDofs[iTotalEdgeDof++] = iEdgeFirstVert * nDofPerVert + iVertexDof ;
757 vecEdgeDofs[iTotalEdgeDof++] = iEdgeSecondVert * nDofPerVert + iVertexDof ;
761 for ( ID iEdgeDof = 0; iEdgeDof < nDofPerEdge; ++iEdgeDof )
763 vecEdgeDofs[iTotalEdgeDof++] = nDofPerVert * nBElemVertices + iBElemEdge * nDofPerEdge + iEdgeDof ;
768 for (iTotalEdgeDof = 0; iTotalEdgeDof < vecEdgeDofs.size(); iTotalEdgeDof++)
770 UInt lDof = vecEdgeDofs[iTotalEdgeDof];
771 UInt gDof = localToGlobalMapOnBElem[ lDof ];
774 if ( bcBaseIterator->isDataAVector() )
776 bcBaseIterator->addBCIdentifier (
new BCIdentifierBase ( gDof ) );
781 boundaryFE.coorMap ( x, y, z, boundaryFE.refFE().xi ( lDof ), boundaryFE.refFE().eta ( lDof ) );
782 bcBaseIterator->addBCIdentifier (
new BCIdentifierEssential ( gDof, x, y, z ) );
794 if ( (beginEssVertices != M_bcList.end() ) && nDofPerVert)
797 for (
ID iBElemVert = 0; iBElemVert < nBElemVertices; ++iBElemVert )
799 marker = mesh.boundaryFacet ( iBoundaryElement ).point ( iBElemVert ).markerID();
802 bcBaseIterator = beginEssVertices;
803 while ( ( bcBaseIterator = std::find ( bcBaseIterator, M_bcList.end(), marker ) ) != M_bcList.end() )
805 for ( ID iVertexDof = 0; iVertexDof < nDofPerVert; ++iVertexDof )
807 UInt lDof = iBElemVert * nDofPerVert + iVertexDof ;
808 UInt gDof = localToGlobalMapOnBElem[lDof];
811 if ( bcBaseIterator->isDataAVector() )
813 bcBaseIterator->addBCIdentifier (
new BCIdentifierBase ( gDof ) );
818 boundaryFE.coorMap ( x, y, z, boundaryFE.refFE().xi ( lDof ), boundaryFE.refFE().eta ( lDof ) );
819 bcBaseIterator->addBCIdentifier (
new BCIdentifierEssential ( gDof, x, y, z ) );
831 if ( notFoundMarkers.size() > 0 )
835 debugStream (5010) <<
836 "WARNING -- BCHandler::bcUpdate()\n" <<
837 " boundary degrees of freedom with the following markers\n" <<
838 " have no boundary condition set: ";
839 for ( std::set<bcFlag_Type>::iterator it = notFoundMarkers.begin();
840 it != notFoundMarkers.end(); ++it )
842 debugStream (5010) << *it <<
" ";
844 debugStream (5010) <<
"\n";
853 for ( bcBaseIterator = M_bcList.begin(); bcBaseIterator != M_bcList.end(); ++bcBaseIterator )
855 bcBaseIterator->copyIdSetIntoIdVector();
const BCBase & operator[](const ID &) const
Extract a BC in the list, const.
bcBaseIterator_Type begin()
Iterator of the beginning of the boundary elements list.
BCBase & findBCWithFlag(const bcFlag_Type &aFlag)
Extract a BC in the list according to its flag.
void addBC(const BCBase &bcBase)
Add new BC to the list using a BCBase object.
BCFunctionUDepBase - class that holds the function used for prescribing boundary conditions.
markerID_Type bcFlag_Type
void modifyBC(bcFlag_Type const &aFlag, BCVectorBase const &bcVector)
Modify the boundary condition associated with flag aFlag, assigning the FE vector in bcVector...
void bcUpdate(Mesh &mesh, CurrentFEManifold &boundaryFE, const DOF &dof)
Update all the boundary conditions.
std::set< bcFlag_Type > M_notFoundMarkers
set of markers which are in the mesh but not in the list
A class for a finite element on a manifold.
bcBaseIterator_Type end()
Iterator of the end of the boundary elements list.
BCHandler - class for handling boundary conditions.
void modifyBC(bcFlag_Type const &aFlag, bcType_Type const &bcType)
Modify the boundary condition associated with flag aFlag, assigning the type in bcType.
std::vector< BCBase > M_bcList
vector list holding the stored BCs
UInt numberOfBCWithType(const bcType_Type &aType) const
Get the number of boundary conditions with type aType.
int32_type Int
Generic integer data.
std::vector< BCBase >::const_iterator bcBaseConstIterator_Type
const UInt & nbDofPerVertex() const
Return the number of degrees of freedom located on the vertices (0D structures)
BCBase & operator[](const ID &)
Extract a BC in the list.
BCBase * findBC(const bcFlag_Type &aFlag)
Find the BC named aFlag.
void modifyBC(bcFlag_Type const &aFlag, BCFunctionBase const &bcFunction)
Modify the boundary condition associated with flag aFlag, assigning the function in bcFunction...
void updateInverseJacobian(const UInt &iQuadPt)
bool hasOnlyEssential() const
Determine whether all the stored boundary conditions have EssentialXXX type.
std::vector< bcName_Type > findAllBCWithType(const bcType_Type &aType) const
Get a vector list of BC with specific type. The list contains the bcName_Type of the BC...
void showMe(bool verbose=false, std::ostream &out=std::cout) const
Display the content of the variables.
const BCBase & findBCWithFlag(const bcFlag_Type &aFlag) const
Extract a BC in the list according to its flag (non const)
BCFunctionBase - class that holds the function used for prescribing boundary conditions.
std::vector< ID > bcComponentsVec_Type
BCHandler()
Empty Constructor.
BCVectorBase - class that holds the FE vectors used for prescribing boundary conditions.
void setOffset(const UInt &offset)
Set offset in all boundary conditions.
std::vector< BCBase >::iterator bcBaseIterator_Type
bcBaseConstIterator_Type end() const
void merge(BCHandler &bcHandler)
Merges the boundary condition bcHandler (with its offset) with the stored one.
bcBaseConstIterator_Type begin() const
double Real
Generic real data.
void M_sumOffsets()
Sum the M_offset to boundary conditions offsets.
const DOFLocalPattern & localDofPattern() const
Getter for the localDofPattern.
BCHandler(const BCHandler &bcHandler)
Copy constructor.
BCFunctionBase bcFunction_Type
bool bcUpdateDone() const
Determine whether bcUpdate has been done before.
const UInt & nbDofPerEdge() const
Return the number of degrees of freedom located on the edges (1D structures)
void modifyBC(bcFlag_Type const &aFlag, BCFunctionUDepBase const &bcFunctionFEVectorDependent)
Modify the boundary condition associated with flag aFlag, assigning the function in bcFunctionFEVecto...
UInt size() const
Number of the stored boundary conditions.
bool M_bcUpdateDone
true only if the bcUpdate has been done
bool empty() const
Determine whether no boundary conditions are stored.
std::vector< std::shared_ptr< BCIdentifierBase > > M_idVector
container for id's when the list is finalized
uint32_type UInt
generic unsigned integer (used mainly for addressing)
BCHandler & operator=(const BCHandler &bcHandler)
Assignment operator.
const flag_Type UPDATE_ONLY_CELL_NODES(1)