63 #include <lifev/core/LifeV.hpp> 64 #include <lifev/core/fem/BCBase.hpp> 96 ERROR_MSG (
"BCBase::BCBase: You should use a more specific constructor for this mode" );
118 UInt numberOfComponents;
122 numberOfComponents = 1;
123 M_components.reserve ( numberOfComponents );
124 M_components.push_back ( 0 );
128 M_components.reserve ( numberOfComponents );
129 for (
ID i = 0; i < numberOfComponents; ++i )
131 M_components.push_back ( i );
138 numberOfComponents = 1;
139 M_components.reserve ( numberOfComponents );
140 M_components.push_back ( nDimensions - 1 );
145 M_components.reserve ( numberOfComponents );
146 for (
ID i = 0; i < numberOfComponents; ++i )
148 M_components.push_back ( i );
153 numberOfComponents = 1;
154 M_components.reserve ( numberOfComponents );
155 M_components.push_back ( nDimensions - 1 );
158 ERROR_MSG (
"BCBase::BCBase: You should use a more specific constructor for this mode" );
167 const UInt& numberOfComponents )
184 ERROR_MSG (
"BCBase::BCBase: You should use a more specific constructor for this mode" );
186 M_components.reserve ( numberOfComponents );
187 for (
ID i = 0; i < numberOfComponents; ++i )
189 M_components.push_back ( i );
217 ERROR_MSG (
"BCBase::BCBase: You should use a more specific constructor for this mode" );
240 UInt numberOfComponents;
244 numberOfComponents = 1;
245 M_components.reserve ( numberOfComponents );
246 M_components.push_back ( 0 );
251 M_components.reserve ( numberOfComponents );
252 for (
ID i = 0; i < numberOfComponents; ++i )
254 M_components.push_back ( i );
259 numberOfComponents = 1;
260 M_components.reserve ( numberOfComponents );
261 M_components.push_back ( nDimensions - 1 );
265 numberOfComponents = 1;
266 M_components.reserve ( numberOfComponents );
267 M_components.push_back ( nDimensions - 1 );
270 ERROR_MSG (
"BCBase::BCBase: You should use a more specific constructor for this mode" );
280 const UInt& numberOfComponents )
297 ERROR_MSG (
"BCBase::BCBase: You should use a more specific constructor for this mode" );
300 M_components.reserve ( numberOfComponents );
301 for (
ID i = 0; i < numberOfComponents; ++i )
303 M_components.push_back ( i );
329 ERROR_MSG (
"BCBase::BCBase: You should use a more specific constructor for this mode" );
352 UInt numberOfComponents;
356 numberOfComponents = 1;
357 M_components.reserve ( numberOfComponents );
358 M_components.push_back ( 0 );
362 M_components.reserve ( numberOfComponents );
363 for (
ID i = 0; i < numberOfComponents; ++i )
365 M_components.push_back ( i );
369 numberOfComponents = 1;
370 M_components.reserve ( numberOfComponents );
371 M_components.push_back ( nDimensions - 1 );
374 numberOfComponents = 1;
375 M_components.reserve ( numberOfComponents );
376 M_components.push_back ( nDimensions - 1);
379 ERROR_MSG (
"BCBase::BCBase: You should use a more specific constructor for this mode" );
389 const UInt& numberOfComponents )
406 ERROR_MSG (
"BCBase::BCBase: You should use a more specific constructor for this mode" );
409 M_components.reserve ( numberOfComponents );
410 for (
ID i = 0; i < numberOfComponents; ++i )
412 M_components.push_back ( i );
434 if ( bcBase.M_bcFunction.get() != 0 )
436 M_bcFunction = bcBase.M_bcFunction->clone();
438 if ( bcBase.M_bcFunctionFEVectorDependent.get() != 0 )
440 M_bcFunctionFEVectorDependent = bcBase.M_bcFunctionFEVectorDependent->clone();
442 if ( bcBase.M_bcVector.get() != 0 )
444 M_bcVector = bcBase.M_bcVector->clone();
451 if ( !M_idVector.empty() || !bcBase.M_idVector.empty() )
453 ERROR_MSG (
"BCBase::BCBase : The BC copy constructor does not work with list of identifiers which are not empty" );
469 return M_components[ i ];
476 return (*M_bcVector).isRobinCoeffAVector();
480 ERROR_MSG (
"BCBase::Robin : A data vector must be specified before calling this method" );
490 return (*M_bcVector).isBetaCoeffAVector();
494 ERROR_MSG (
"BCBase::beta: A data vector must be specified before calling this method" );
504 return ( *M_bcVector).robinCoeffVector ( iDof, iComponent );
508 ERROR_MSG (
"BCBase::RobinVec : A data vector must be specified before calling this method" );
517 return ( *M_bcVector).betaCoeffVector ( iDof, iComponent );
521 ERROR_MSG (
"BCBase::RobinVec : A data vector must be specified before calling this method" );
530 return M_bcFunction.get();
535 return M_bcFunctionFEVectorDependent.get();
540 return M_bcVector.get();
546 M_idSet.insert ( std::shared_ptr<BCIdentifierBase> ( identifierToAddPtr ) );
553 return M_idVector.size();
559 out <<
"********************************" << std::endl;
560 out <<
"BC Name : " << M_name << std::endl;
561 out <<
"Flag : " << M_flag << std::endl;
562 out <<
"Type : " << M_type << std::endl;
563 out <<
"Mode : " << M_mode << std::endl;
564 out <<
"Number of components : " << M_components.size() << std::endl;
565 out <<
"List of components : ";
566 for ( ID i = 0; i < M_components.size(); ++i )
568 out << M_components[ i ] <<
" ";
571 out <<
"Offset : " << M_offset << std::endl;
572 out <<
"Number of stored ID's: " << M_idVector.size() << std::endl;
576 unsigned int count ( 0 ), lines ( 10 );
577 out <<
"IDs in list";
578 for ( std::vector<std::shared_ptr<BCIdentifierBase> >::const_iterator i = M_idVector.begin();
579 i != M_idVector.end(); ++i )
581 if ( count++ % lines == 0 )
585 out << ( *i ) ->id() <<
" ";
587 if ( count % lines != 0 )
593 M_bcVector->showMe ( verbose, out );
597 out <<
"********************************" << std::endl;
615 M_bcFunctionFEVectorDependent = BCb.M_bcFunctionFEVectorDependent;
616 M_bcFunction = BCb.M_bcFunction;
617 M_bcVector = BCb.M_bcVector;
629 if ( !M_idVector.empty() || !BCb.M_idVector.empty() )
631 ERROR_MSG (
"BCBase::operator= : The BC assigment operator does not work with lists of identifiers which are not empty" );
640 ASSERT_PRE ( M_finalized,
"BC List should be finalized before being accessed" );
642 return M_idVector[ i ].get();
646 const Real& z,
const ID& iComponent )
const 648 return M_bcFunction->operator() ( t, x, y, z, iComponent );
652 const Real& z,
const ID& iComponent,
const Real& u )
const 656 return M_bcFunctionFEVectorDependent->operator() (t, x, y, z, iComponent, u);
664 return ( *M_bcVector ) ( iDof, iComponent );
668 ERROR_MSG (
"BCBase::operator() : A data vector must be specified before calling this method" );
681 M_bcVector = std::shared_ptr<BCVectorBase > ( bcVector.clone() );
689 M_bcFunction = bcFunction.clone();
697 M_bcFunctionFEVectorDependent = bcFunctionFEVectorDependent.clone();
729 return M_components.size();
736 return ( *M_bcVector ).robinCoeff();
740 ERROR_MSG (
"BCBase::robinCoef : A data vector must be specified before calling this method" );
750 return ( *M_bcVector ).resistanceCoeff();
754 ERROR_MSG (
"BCBase::resistanceCoef : A data vector must be specified before calling this method" );
764 return ( *M_bcVector ).betaCoeff();
768 ERROR_MSG (
"BCBase::robinCoef : A data vector must be specified before calling this method" );
797 if ( ! M_idSet.empty() )
800 M_idVector.reserve ( M_idSet.size() );
801 std::copy ( M_idSet.begin(), M_idSet.end(), std::inserter ( M_idVector, M_idVector.end() ) );
BCBase & operator=(const BCBase &bcBase)
The assignment operator for BCBase.
BCBase(const bcName_Type &name, const bcFlag_Type &flag, const bcType_Type &type, const bcMode_Type &mode, BCVectorBase &vector, const bcComponentsVec_Type &components)
Constructor for BCBase to prescribe a boundary condition from a vector of dof values.
bool isBetaCoeffAVector() const
Returns true if beta coefficient (in BC Vector ) is a VectorEpetra (betaVec) (default betaCoef=1) ...
bool isRobinCoeffAVector() const
Returns true if robin coefficient (in BC Vector ) is a VectorEpetra, false if it is scalar (default a...
bcMode_Type M_mode
the boundary condition mode of application
BCBase(const bcName_Type &name, const bcFlag_Type &flag, const bcType_Type &type, const bcMode_Type &mode, BCVectorBase &bcVector, const UInt &numberOfComponents)
Constructor for BCBase to prescribe a boundary condition from a vector of dof values without specifyi...
BCBase(const bcName_Type &name, const bcFlag_Type &flag, const bcType_Type &type, const bcMode_Type &mode, BCFunctionUDepBase &bcFunctionFEVectorDependent, const UInt &numberOfComponents)
Constructor for BCBase without specifying components for Full mode problems. The BC function depends ...
bcType_Type type() const
Returns the boundary condition type.
BCFunctionUDepBase - class that holds the function used for prescribing boundary conditions.
markerID_Type bcFlag_Type
Real betaCoeffVector(const ID &iDof, const ID &iComponent) const
Returns the value of the beta coefficient vector (in BC Vector)
Real robinCoeffVector(const ID &iDof, const ID &iComponent) const
Returns the value of the robin coefficient vector (in BC Vector)
bcComponentsVec_Type M_components
void addBCIdentifier(BCIdentifierBase *identifierToAddPtr)
Adds a new identifier to the list.
Real betaCoeff() const
Returns the value of the beta coefficient (in BC Vector)
std::string M_name
name of the boundary condition
bcFlag_Type flag() const
Returns the flag associated to the boundary condition name.
bcType_Type M_type
the boundary condition type
BCBase(const bcName_Type &name, const bcFlag_Type &flag, const bcType_Type &type, const bcMode_Type &mode, BCFunctionBase &bcFunction, const UInt &numberOfComponents)
Constructor for BCBase without specifying components for without list of components for Full mode pro...
bool isDataAVector() const
Returns True if a FE BCVector has been provided to the class, False otherwise.
void updateInverseJacobian(const UInt &iQuadPt)
BCBase(const bcName_Type &name, const bcFlag_Type &flag, const bcType_Type &type, const bcMode_Type &mode, BCFunctionBase &bcFunction, const bcComponentsVec_Type &components)
Constructor for BCBase.
Real operator()(const Real &t, const Real &x, const Real &y, const Real &z, const ID &iComponent) const
Overloading function operator by calling the BCFunctionBase user specified function.
BCFunctionBase - class that holds the function used for prescribing boundary conditions.
UInt numberOfComponents() const
Returns the number of components involved in this boundary condition.
std::vector< ID > bcComponentsVec_Type
bool M_finalized
True, when M_idVector is finalized.
BCVectorBase - class that holds the FE vectors used for prescribing boundary conditions.
BCBase(const bcName_Type &name, const bcFlag_Type &flag, const bcType_Type &type, const bcMode_Type &mode, BCFunctionUDepBase &bcFunctionFEVectorDependent)
Constructor for BCBase without specifying components for Scalar, Tangential or Normal mode problems...
void setBCFunction(const BCFunctionBase &bcFunction)
set BCFunctionBase boundary condition
bcMode_Type mode() const
Returns the boundary condition mode.
void setBCVector(const BCVectorBase &bcVector)
set BCVectorBase boundary condition
bool M_isStored_BcFunctionVectorDependent
True if a FE BCVector has been provided.
BCBase()
Empty constructor.
bool finalized() const
Returns whether the list is finalized and the vector of ID's is then accessible.
Real operator()(const ID &iDof, const ID &iComponent) const
Overloading function operator by querying the BCVector in DOF iDof and component iComponent.
BCBase(const bcName_Type &name, const bcFlag_Type &flag, const bcType_Type &type, const bcMode_Type &mode, BCVectorBase &bcVector)
Constructor for BCBase to prescribe a boundary condition from a vector of dof values without specifyi...
bool isUDep() const
Returns True if the BCBase is based on a BCFunctionUDepBase function, False otherwise.
BCIdentifierBase - Base class holding DOF identifiers for implementing BC.
int M_offset
boundary condition offset
Real resistanceCoeff() const
Returns the value of the resistance coefficient (in BC Vector)
std::ostream & showMe(bool verbose=false, std::ostream &outStream=std::cout) const
Method that writes info in output.
double Real
Generic real data.
BCBase(const bcName_Type &name, const bcFlag_Type &flag, const bcType_Type &type, const bcMode_Type &mode, BCFunctionBase &bcFunction)
Constructor for BCBase without specifying components for Scalar, Tangential or Normal mode problems...
const BCIdentifierBase * operator[](const ID &i) const
Returns a pointer to the (i)-th element of the list of identifiers.
NdebugStream noDebugStream(int=0, NdebugStream::stprintf=&printf)
const UInt nDimensions(NDIM)
void setBCFunction(const BCFunctionUDepBase &bcFunctionFEVectorDependent)
set BCFunctionUDepBase boundary condition
ID component(const ID i) const
Returns the index of the component of the solution associated to the iComponent-th component prescrib...
const BCFunctionBase * pointerToFunctor() const
Returns a pointer to the BCFunctionBase object.
Real operator()(const Real &t, const Real &x, const Real &y, const Real &z, const ID &iComponent, const Real &u) const
Overloading function operator by calling the BCFunctionUDepBase user specified function.
UInt list_size() const
Returns the size of the identifiers list.
void copyIdSetIntoIdVector()
bcFlag_Type M_flag
flag identifying a specific part of the mesh boundary
std::vector< std::shared_ptr< BCIdentifierBase > > M_idVector
container for id's when the list is finalized
std::string name() const
Returns the boundary condition name.
Real robinCoeff() const
Returns the value of the robin coefficient (in BC Vector)
const BCFunctionUDepBase * pointerToFunctorUDep() const
Returns a pointer to the BCFunctionUDepBase object.
BCBase(const bcName_Type &name, const bcFlag_Type &flag, const bcType_Type &type, const bcMode_Type &mode, BCFunctionUDepBase &bcFunctionFEVectorDependent, const bcComponentsVec_Type &components)
Constructor for BCBase. The BC function depends on a generic FE vector (e.g. the solution at the prev...
uint32_type UInt
generic unsigned integer (used mainly for addressing)
const BCVectorBase * pointerToBCVector() const
Returns a pointer to the BCVector object.
BCBase(const BCBase &bcBase)
Copy constructor for BCBase.