42 #include <boost/lambda/lambda.hpp> 43 #include <boost/lambda/bind.hpp> 44 #include <boost/lambda/if.hpp> 46 #include <lifev/core/fem/BCHandler.hpp> 84 M_bcList = BCh.M_bcList;
85 M_notFoundMarkers = BCh.M_notFoundMarkers;
100 return M_bcList[ i ];
115 M_bcList.push_back ( BCBase ( name, flag, type, mode, bcFunction, components ) );
116 std::sort ( M_bcList.begin(), M_bcList.end() );
127 M_bcList.push_back ( BCBase ( name, flag, type, mode, bcFunction ) );
128 std::sort ( M_bcList.begin(), M_bcList.end() );
137 const UInt& numComponents )
139 M_bcList.push_back ( BCBase ( name, flag, type, mode, bcFunction, numComponents ) );
140 std::sort ( M_bcList.begin(), M_bcList.end() );
151 M_bcList.push_back ( BCBase ( name, flag, type, mode, bcVector, numComponents ) );
152 std::sort ( M_bcList.begin(), M_bcList.end() );
162 M_bcList.push_back ( BCBase ( name, flag, type, mode, bcVector ) );
163 std::sort ( M_bcList.begin(), M_bcList.end() );
172 const UInt& numComponents )
174 M_bcList.push_back ( BCBase ( name, flag, type, mode, bcVector, numComponents ) );
175 std::sort ( M_bcList.begin(), M_bcList.end() );
185 M_bcList.push_back ( BCBase ( name, flag, type, mode, bcUDepFunction ) );
186 std::sort ( M_bcList.begin(), M_bcList.end() );
192 M_bcList.push_back ( bcBase );
193 std::sort ( M_bcList.begin(), M_bcList.end() );
223 std::cout <<
"XXX21" << std::endl;
227 std::cout <<
"XXX22" << std::endl;
259 M_bcList.insert (M_bcList.end(), bcHandler.M_bcList.begin(), bcHandler.M_bcList.end() );
267 out <<
" Boundary Conditions Handler ====>" << std::endl;
268 out <<
" Number of BC stored " << size() << std::endl;
270 out <<
" List => " << std::endl;
271 for ( UInt i = 0; i < M_bcList.size(); ++i )
273 M_bcList[ i ].showMe ( verbose, out );
275 out <<
" <===========================>" << std::endl;
294 std::cout <<
"BCHandler::setOffset : BC " << name <<
" not found ... ";
308 for (i = 0; i < M_bcList.size(); i++)
309 if (aFlag == M_bcList[i].flag() )
322 for (i = 0; i < M_bcList.size(); i++)
323 if (aFlag == M_bcList[i].flag() )
334 std::vector<bcName_Type> vectorName;
336 for ( std::size_t i = 0; i < M_bcList.size(); ++i )
337 if ( M_bcList[i].type() == type)
339 vectorName.push_back ( M_bcList[i].name() );
350 for ( std::size_t i = 0; i < M_bcList.size(); ++i )
351 if ( M_bcList[i].type() == type)
362 return &M_bcList[ findBCIndexWithName (name) ];
370 for ( ; iBC < M_bcList.size(); iBC++ )
371 if (M_bcList[iBC].name() == name)
376 if ( iBC == M_bcList.size() )
378 std::ostringstream __ex;
379 __ex << name <<
" was not found in this Boundary conditions set\n" 380 <<
"This set contains \n";
381 for ( UInt i = 0; i < M_bcList.size(); ++i )
383 M_bcList[ i ].showMe (
true, __ex );
385 throw std::invalid_argument ( __ex.str() );
396 std::map<bcFlag_Type, std::set<ID> > nonEssentialConditions;
397 std::set<ID> nonEssentialComponents;
400 nonEssentialComponents.insert (i);
403 for ( bcBaseConstIterator_Type it = M_bcList.begin(); it != M_bcList.end(); ++it )
405 nonEssentialConditions.insert (std::make_pair (it->flag(), nonEssentialComponents) );
410 if ( it->type() == Essential )
416 nonEssentialConditions.erase (it->flag() );
419 nonEssentialConditions.find (it->flag() )->second.erase (0);
422 for ( UInt iComp = 0; iComp < it->numberOfComponents(); ++iComp )
424 nonEssentialConditions.find (it->flag() )->second.erase ( it->component (iComp) );
426 if ( nonEssentialConditions.find (it->flag() )->second.empty() )
428 nonEssentialConditions.erase (it->flag() );
436 return ( nonEssentialConditions.empty() );
445 std::string Pippo =
"Pippo";
447 std::for_each ( M_bcList.begin(),
449 [&name, &bcBasePtr] (LifeV::BCBase i) {
if ((std::bind ( &BCBase::name, i ))() == name)
456 std::ostringstream __ex;
457 __ex <<
"Invalid name for BC to be modified : " << name <<
"\n" 458 <<
"The list of available BCs is:\n";
459 std::for_each ( M_bcList.begin(),
461 [] (BCBase i) { std::cout << (std::bind (
462 &BCBase::name, i ))() <<
'\n'; }
464 throw std::invalid_argument ( __ex.str() );
473 std::cout <<
"XXX23" << std::endl;
474 std::for_each ( M_bcList.begin(),
476 [&aFlag, &bcBasePtr] (LifeV::BCBase i) {
if ((std::bind ( &BCBase::flag, i ))() == aFlag)
479 std::cout <<
"XXX24" << std::endl;
488 for ( bcBaseIterator_Type it = M_bcList.begin(); it != M_bcList.end(); ++it )
490 it->setOffset (it->offset() + M_offset);
void addBC(const std::string &name, const bcFlag_Type &flag, const bcType_Type &type, const bcMode_Type &mode, BCFunctionBase &bcFunction, const UInt &numberOfComponents)
Add new BC to the list for Full mode problems (user defined function case)
const BCBase & operator[](const ID &) const
Extract a BC in the list, const.
BCBase & findBCWithFlag(const bcFlag_Type &aFlag)
Extract a BC in the list according to its flag.
void addBC(const std::string &name, const bcFlag_Type &flag, const bcType_Type &type, const bcMode_Type &mode, BCVectorBase &bcVector)
Add new BC to the list for Scalar, Tangential or Normal mode problems (data vector case) ...
void addBC(const std::string &name, const bcFlag_Type &flag, const bcType_Type &type, const bcMode_Type &mode, BCVectorBase &bcVector, const UInt &nComp)
Add new BC to the list for Full mode problems (data vector case)
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...
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.
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
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 addBC(const std::string &name, const bcFlag_Type &flag, const bcType_Type &type, const bcMode_Type &mode, BCFunctionBase &bcFunction, const bcComponentsVec_Type &components)
Add new BC to the list for Component or Directional mode problems (user defined function case) ...
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.
void setOffset(const std::string &name, Int offset)
Set offset in boundary conditions name.
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.
void setBCFunction(const BCFunctionBase &bcFunction)
set BCFunctionBase boundary condition
void setBCVector(const BCVectorBase &bcVector)
set BCVectorBase boundary condition
void addBC(const std::string &name, const bcFlag_Type &flag, const bcType_Type &type, const bcMode_Type &mode, BCVectorBase &bcVector, const bcComponentsVec_Type &components)
Add new BC to the list for Component or Directional mode problems (data vector case) ...
bcBaseConstIterator_Type end() const
void merge(BCHandler &bcHandler)
Merges the boundary condition bcHandler (with its offset) with the stored one.
void modifyBC(std::string const &name, BCFunctionBase const &bcFunction)
Modify the boundary condition name, assigning the function bcFunction.
void modifyBC(std::string const &name, BCVectorBase const &bcVector)
Modify the boundary condition assigning the FE vector in bcVector.
void setOffset(int bcOffset)
Set the BC offset.
bcBaseConstIterator_Type begin() const
BCBase * findBC(const std::string &name)
Find the BC named name.
const BCBase * findBCWithName(const bcName_Type &name) const
void M_sumOffsets()
Sum the M_offset to boundary conditions offsets.
void setType(const bcType_Type &bcType)
Set the BC type.
const UInt nDimensions(NDIM)
ID findBCIndexWithName(const bcName_Type &name) const
void setBCFunction(const BCFunctionUDepBase &bcFunctionFEVectorDependent)
set BCFunctionUDepBase boundary condition
BCHandler(const BCHandler &bcHandler)
Copy constructor.
void modifyBC(std::string const &name, BCFunctionUDepBase const &bcFunctionFEVectorDependent)
Modify the boundary condition name, assigning the function in bcFunctionFEVectorDependent.
void modifyBC(bcFlag_Type const &aFlag, BCFunctionUDepBase const &bcFunctionFEVectorDependent)
Modify the boundary condition associated with flag aFlag, assigning the function in bcFunctionFEVecto...
bool M_bcUpdateDone
true only if the bcUpdate has been done
void addBC(const std::string &name, const bcFlag_Type &flag, const bcType_Type &type, const bcMode_Type &mode, BCFunctionBase &bcFunction)
Add new BC to the list for Scalar, Tangential or Normal mode problems (user defined function case) ...
std::vector< std::shared_ptr< BCIdentifierBase > > M_idVector
container for id's when the list is finalized
void addBC(const std::string &name, const bcFlag_Type &flag, const bcType_Type &type, const bcMode_Type &mode, BCFunctionUDepBase &bcFunctionFEVectorDependent)
Add new BC to the list for Scalar, Tangential or Normal mode problems (user defined function case...
uint32_type UInt
generic unsigned integer (used mainly for addressing)
BCHandler & operator=(const BCHandler &bcHandler)
Assignment operator.