LifeV
|
BCHandler - class for handling boundary conditions. More...
#include <BCHandler.hpp>
Private Member Functions | |
BCBase * | findBC (const std::string &name) |
Find the BC named name . More... | |
BCBase * | findBC (const bcFlag_Type &aFlag) |
Find the BC named aFlag . More... | |
void | M_sumOffsets () |
Sum the M_offset to boundary conditions offsets. More... | |
Private Attributes | |
bool | M_bcUpdateDone |
true only if the bcUpdate has been done More... | |
std::vector< BCBase > | M_bcList |
vector list holding the stored BCs More... | |
UInt | M_offset |
offset More... | |
std::set< bcFlag_Type > | M_notFoundMarkers |
set of markers which are in the mesh but not in the list More... | |
Public Types | |
typedef std::vector< BCBase >::iterator | bcBaseIterator_Type |
typedef std::vector< BCBase >::const_iterator | bcBaseConstIterator_Type |
typedef BCFunctionBase | bcFunction_Type |
Constructor & Destructor | |
BCHandler () | |
Empty Constructor. More... | |
BCHandler (const BCHandler &bcHandler) | |
Copy constructor. More... | |
~BCHandler () | |
Destructor. More... | |
Operators | |
BCHandler & | operator= (const BCHandler &bcHandler) |
Assignment operator. More... | |
BCBase & | operator[] (const ID &) |
Extract a BC in the list. More... | |
const BCBase & | operator[] (const ID &) const |
Extract a BC in the list, const. More... | |
Methods | |
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) More... | |
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) More... | |
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) More... | |
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) More... | |
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) More... | |
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) More... | |
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, with function depending on U) More... | |
void | addBC (const BCBase &bcBase) |
Add new BC to the list using a BCBase object. More... | |
void | modifyBC (std::string const &name, BCFunctionBase const &bcFunction) |
Modify the boundary condition name , assigning the function bcFunction . More... | |
void | modifyBC (std::string const &name, BCVectorBase const &bcVector) |
Modify the boundary condition assigning the FE vector in bcVector . More... | |
void | modifyBC (std::string const &name, BCFunctionUDepBase const &bcFunctionFEVectorDependent) |
Modify the boundary condition name , assigning the function in bcFunctionFEVectorDependent . More... | |
void | modifyBC (bcFlag_Type const &aFlag, BCFunctionBase const &bcFunction) |
Modify the boundary condition associated with flag aFlag , assigning the function in bcFunction . More... | |
void | modifyBC (bcFlag_Type const &aFlag, BCVectorBase const &bcVector) |
Modify the boundary condition associated with flag aFlag , assigning the FE vector in bcVector . More... | |
void | modifyBC (bcFlag_Type const &aFlag, BCFunctionUDepBase const &bcFunctionFEVectorDependent) |
Modify the boundary condition associated with flag aFlag , assigning the function in bcFunctionFEVectorDependent . More... | |
void | modifyBC (bcFlag_Type const &aFlag, bcType_Type const &bcType) |
Modify the boundary condition associated with flag aFlag , assigning the type in bcType . More... | |
template<typename Mesh > | |
void | bcUpdate (Mesh &mesh, CurrentFEManifold &boundaryFE, const DOF &dof) |
Update all the boundary conditions. More... | |
void | merge (BCHandler &bcHandler) |
Merges the boundary condition bcHandler (with its offset) with the stored one. More... | |
void | showMe (bool verbose=false, std::ostream &out=std::cout) const |
Display the content of the variables. More... | |
Set Methods | |
void | setOffset (const UInt &offset) |
Set offset in all boundary conditions. More... | |
void | setOffset (const std::string &name, Int offset) |
Set offset in boundary conditions name . More... | |
Get Methods | |
BCBase & | findBCWithFlag (const bcFlag_Type &aFlag) |
Extract a BC in the list according to its flag. More... | |
const BCBase & | findBCWithFlag (const bcFlag_Type &aFlag) const |
Extract a BC in the list according to its flag (non const) More... | |
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. More... | |
UInt | numberOfBCWithType (const bcType_Type &aType) const |
Get the number of boundary conditions with type aType . More... | |
ID | findBCIndexWithName (const bcName_Type &name) const |
const BCBase * | findBCWithName (const bcName_Type &name) const |
UInt | offset () const |
bcBaseIterator_Type | begin () |
Iterator of the beginning of the boundary elements list. More... | |
bcBaseConstIterator_Type | begin () const |
bcBaseIterator_Type | end () |
Iterator of the end of the boundary elements list. More... | |
bcBaseConstIterator_Type | end () const |
UInt | size () const |
Number of the stored boundary conditions. More... | |
bool | empty () const |
Determine whether no boundary conditions are stored. More... | |
bool | bcUpdateDone () const |
Determine whether bcUpdate has been done before. More... | |
bool | hasOnlyEssential () const |
Determine whether all the stored boundary conditions have EssentialXXX type. More... | |
BCHandler - class for handling boundary conditions.
Container for BCBase
classes
BCHandler
is a container of BCBase
objects. It instantiates the needed BCBase
objects and provide them with the data needed. As an example, if a BCBase
object is related with an Essential boundary condition, then the global DOFs IDs associated with that essential boundary conditions will be passed to the object.
Boundary conditions are added using the method addBC
(name
, flag
, type
, ...). type
is a bcType_Type
and describes the type of boundary condition (Essential
, Natural
, etc.). flag
is used to determine on which elements the boundary condition should be prescribed.
In general flag
refers to the boundary elements' marker. The only exception are the bcType_Type
EssentialEdges
and EssentialVertices
. In these two cases the flag refers respectively to the Edges' markers and to the Vertices' markers. In general EssentialEdges
and EssentialVertices
types are not recommended and they should be used only by advanced users.
For this reasons boundary element markers are needed (and they better be specified in the mesh files).
The typical way to use the class is to create function handlers:
BCFunctionBase bcFuncEss( solOnBoundary ), bcFuncNat( ZeroFunction);
Then, instantiate a BCHandler object and add boundary conditions (this will create BCBase
objects).
BCHandler bcHandler; bcHandler.addBC( "inlet", 10, Essential, Full, bcFuncEss, 3 ); bcHandler.addBC( "outlet", 20, Natural, Full, bcFuncNat, 3 ); bcHandler.addBC( "wall", 30, Essential, Full, bcFuncEss, 3 );
Number 10, 20, 30 refers to the markers on the mesh boundary elements (facets: faces in 3D, edges in 2D). More information about boundary conditions will be found in BCBase.hpp
Then, update the boundary conditions, using the function bcUpdate
bcHandler.bcUpdate(mesh, boundaryFe, dof);
This method will looks for the markers in the mesh and will fill the boundary conditions container BCBase, with the appropriate data structures (global DOF id.. coordinates.. ecc)
Now all is set to prescribe boundary conditions using one of the functions in bcManager.hpp
Definition at line 100 of file BCHandler.hpp.
typedef std::vector<BCBase>::iterator bcBaseIterator_Type |
Definition at line 107 of file BCHandler.hpp.
typedef std::vector<BCBase>::const_iterator bcBaseConstIterator_Type |
Definition at line 108 of file BCHandler.hpp.
typedef BCFunctionBase bcFunction_Type |
Definition at line 110 of file BCHandler.hpp.
BCHandler | ( | ) |
Empty Constructor.
Definition at line 54 of file BCHandler.cpp.
Copy constructor.
bcHandler | BCHandler |
Definition at line 60 of file BCHandler.cpp.
~BCHandler | ( | ) |
Destructor.
Definition at line 69 of file BCHandler.cpp.
Extract a BC in the list.
i | Position index |
Definition at line 92 of file BCHandler.cpp.
Extract a BC in the list, const.
i | Position index |
Definition at line 98 of file BCHandler.cpp.
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)
name | The name of the boundary condition |
flag | The mesh flag identifying the part of the mesh where the boundary condition applies |
type | The boundary condition type: Natural, Robin, Flux, Resistance, Periodic, Essential, EssentialEdges, EssentialVertices |
mode | the boundary condition mode: Scalar, Full, Component, Normal, Tangential, Directional |
bcFunction | The container holding the user defined function involved in this boundary condition |
components | storing the list of components involved in this boundary condition |
Definition at line 108 of file BCHandler.cpp.
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)
name | The name of the boundary condition |
flag | The mesh flag identifying the part of the mesh where the boundary condition applies |
type | The boundary condition type: Natural, Robin, Flux, Resistance, Periodic, Essential, EssentialEdges, EssentialVertices |
mode | the boundary condition mode: Scalar, Full, Component, Normal, Tangential, Directional |
bcFunction | The container holding the user defined function involved in this boundary condition |
Definition at line 121 of file BCHandler.cpp.
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)
name | The name of the boundary condition |
flag | The mesh flag identifying the part of the mesh where the boundary condition applies |
type | The boundary condition type: Natural, Robin, Flux, Resistance, Periodic, Essential, EssentialEdges, EssentialVertices |
mode | The boundary condition mode: Scalar, Full, Component, Normal, Tangential, Directional |
bcFunction | The container holding the user defined function involved in this boundary condition |
numberOfComponents | The number of components involved in this boundary condition |
Definition at line 132 of file BCHandler.cpp.
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)
name | The name of the boundary condition |
flag | The mesh flag identifying the part of the mesh where the boundary condition applies |
type | The boundary condition type: Natural, Robin, Flux, Resistance, Periodic, Essential, EssentialEdges, EssentialVertices |
mode | the boundary condition mode: Scalar, Full, Component, Normal, Tangential, Directional |
bcVector | The container holding the finite element vector involved in this boundary condition |
components | storing the list of components involved in this boundary condition |
Definition at line 144 of file BCHandler.cpp.
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)
name | The name of the boundary condition |
flag | The mesh flag identifying the part of the mesh where the boundary condition applies |
type | The boundary condition type: Natural, Robin, Flux, Resistance, Periodic, Essential, EssentialEdges, EssentialVertices |
mode | the boundary condition mode: Scalar, Full, Component, Normal, Tangential, Directional |
bcVector | The container holding the finite element vector involved in this boundary condition |
Definition at line 156 of file BCHandler.cpp.
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)
name | The name of the boundary condition |
flag | The mesh flag identifying the part of the mesh where the boundary condition applies |
type | The boundary condition type: Natural, Robin, Flux, Resistance, Periodic, Essential, EssentialEdges, EssentialVertices |
mode | the boundary condition mode: Scalar, Full, Component, Normal, Tangential, Directional |
bcVector | The container holding the finite element vector involved in this boundary condition |
numberOfComponents | The number of components involved in this boundary condition |
Definition at line 167 of file BCHandler.cpp.
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, with function depending on U)
name | The name of the boundary condition |
flag | The mesh flag identifying the part of the mesh bcBaseIterator the boundary condition applies |
type | The boundary condition type: Natural, Robin, Flux, Resistance, Periodic, Essential, EssentialEdges, EssentialVertices |
mode | the boundary condition mode: Scalar, Full, Component, Normal, Tangential, Directional |
bcFunctionFEVectorDependent | The container holding the user defined function, depending on a FE vector, involved in this boundary condition |
Definition at line 179 of file BCHandler.cpp.
void addBC | ( | const BCBase & | bcBase | ) |
Add new BC to the list using a BCBase object.
bcBase | a BCBase object |
Definition at line 190 of file BCHandler.cpp.
void modifyBC | ( | std::string const & | name, |
BCFunctionBase const & | bcFunction | ||
) |
Modify the boundary condition name
, assigning the function bcFunction
.
name | The name of the boundary condition to be modified |
bcFunction | The container holding the user defined function which will replace the existing one |
Definition at line 197 of file BCHandler.cpp.
void modifyBC | ( | std::string const & | name, |
BCVectorBase const & | bcVector | ||
) |
Modify the boundary condition assigning
the FE vector in bcVector
.
name | The name of the boundary condition to be modified |
bcVector | The container holding the user FE vector which will replace the existing one |
Definition at line 205 of file BCHandler.cpp.
void modifyBC | ( | std::string const & | name, |
BCFunctionUDepBase const & | bcFunctionFEVectorDependent | ||
) |
Modify the boundary condition name
, assigning the function in bcFunctionFEVectorDependent
.
name | The name of the boundary condition to be modified |
bcFunctionFEVectorDependent | The container holding the user defined function, depending on an FE vector, which will replace the existing one |
Definition at line 213 of file BCHandler.cpp.
void modifyBC | ( | bcFlag_Type const & | aFlag, |
BCFunctionBase const & | bcFunction | ||
) |
Modify the boundary condition associated with flag aFlag
, assigning the function in bcFunction
.
aFlag | The flag associated with the boundary condition to be modified |
bcFunction | The container holding the user defined function which will replace the existing one |
Definition at line 221 of file BCHandler.cpp.
void modifyBC | ( | bcFlag_Type const & | aFlag, |
BCVectorBase const & | bcVector | ||
) |
Modify the boundary condition associated with flag aFlag
, assigning the FE vector in bcVector
.
aFlag | The flag associated with the boundary condition to be modified |
bcVector | The container holding the user FE vector which will replace the existing one |
Definition at line 231 of file BCHandler.cpp.
void modifyBC | ( | bcFlag_Type const & | aFlag, |
BCFunctionUDepBase const & | bcFunctionFEVectorDependent | ||
) |
Modify the boundary condition associated with flag aFlag
, assigning the function in bcFunctionFEVectorDependent
.
aFlag | The flag associated with the boundary condition to be modified |
bcFunctionFEVectorDependent | The container holding the user defined function, depending on an FE vector, which will replace the existing one |
Definition at line 239 of file BCHandler.cpp.
void modifyBC | ( | bcFlag_Type const & | aFlag, |
bcType_Type const & | bcType | ||
) |
Modify the boundary condition associated with flag aFlag
, assigning the type in bcType
.
aFlag | The flag associated with the boundary condition to be modified |
bcVector | The type of b.c. which will replace the existing one |
Definition at line 247 of file BCHandler.cpp.
void bcUpdate | ( | Mesh & | mesh, |
CurrentFEManifold & | boundaryFE, | ||
const DOF & | dof | ||
) |
Update all the boundary conditions.
This method update the BC classes checking the markers on the boundary. Except for EssentialEdges and EssentialVertices type of boundary conditions, the flags associated with the boundary conditions will be searched among the markers of the boundary element (facets).
Then, all the DOFs belonging to a matching boundary element will be associated with the appropriate boundary conditions. It is possible then the same DOF is shared by different boundary conditions. In the case of essential boundary conditions, the largest condition will be prescribed on the shared DOF (largest in the ordering given by the operator< in BCBase.hpp) In particular, if two Essential boundary conditions share the same DOF, it will be prescribed the condition with the largest flag. This behavior is due to the fact that the largest boundary condition is the last to be prescribed.
Finally M_bcUpdateDone is set to true, and it is possible to prescribed boundary conditions using functions in BCManage.hpp.
mesh | The mesh |
boundaryFE | Current finite element on the boundary |
dof | Container of the local to global map of DOF id |
Definition at line 560 of file BCHandler.hpp.
void merge | ( | BCHandler & | bcHandler | ) |
Merges the boundary condition bcHandler (with its offset) with the stored one.
bch | BCHandler |
Definition at line 255 of file BCHandler.cpp.
void showMe | ( | bool | verbose = false , |
std::ostream & | out = std::cout |
||
) | const |
Display the content of the variables.
verbose | The verbosity (default: true) |
out | The ostream output (default: std::cout) |
Definition at line 265 of file BCHandler.cpp.
void setOffset | ( | const UInt & | offset | ) |
Set offset
in all boundary conditions.
offset | The boundary condition offset |
Definition at line 282 of file BCHandler.cpp.
void setOffset | ( | const std::string & | name, |
Int | offset | ||
) |
Set offset
in boundary conditions name
.
name | The name of the boundary condition |
offset | The boundary condition offset |
Definition at line 288 of file BCHandler.cpp.
BCBase & findBCWithFlag | ( | const bcFlag_Type & | aFlag | ) |
Extract a BC in the list according to its flag.
aFlag | The flag associated with the boundary condition |
Definition at line 304 of file BCHandler.cpp.
const BCBase & findBCWithFlag | ( | const bcFlag_Type & | aFlag | ) | const |
Extract a BC in the list according to its flag (non const)
aFlag | The flag associated with the boundary condition |
Definition at line 318 of file BCHandler.cpp.
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.
aType | The BC type to be inserted in the list |
Definition at line 332 of file BCHandler.cpp.
UInt numberOfBCWithType | ( | const bcType_Type & | aType | ) | const |
Get the number of boundary conditions with type aType
.
aType | The BC type to be counted |
Definition at line 346 of file BCHandler.cpp.
UInt findBCIndexWithName | ( | const bcName_Type & | name | ) | const |
name | The name of the boundary condition |
Definition at line 366 of file BCHandler.cpp.
const BCBase * findBCWithName | ( | const bcName_Type & | name | ) | const |
name | The name of the boundary condition |
Definition at line 360 of file BCHandler.cpp.
|
inline |
Definition at line 444 of file BCHandler.hpp.
|
inline |
Iterator of the beginning of the boundary elements list.
Definition at line 454 of file BCHandler.hpp.
|
inline |
|
inline |
Iterator of the end of the boundary elements list.
Definition at line 468 of file BCHandler.hpp.
|
inline |
|
inline |
Number of the stored boundary conditions.
Definition at line 482 of file BCHandler.hpp.
|
inline |
Determine whether no boundary conditions are stored.
Definition at line 492 of file BCHandler.hpp.
|
inline |
Determine whether bcUpdate has been done before.
Definition at line 502 of file BCHandler.hpp.
bool hasOnlyEssential | ( | ) | const |
Determine whether all the stored boundary conditions have EssentialXXX type.
It throws a logic_error
exception if state is not consistent with hint.
Definition at line 394 of file BCHandler.cpp.
|
private |
Find the BC named name
.
It throws an invalid_argument
exception if name
is not found.
BCBase
handle invalid name case: ie we didnot find the name in the M_bcList
Definition at line 443 of file BCHandler.cpp.
|
private |
Find the BC named aFlag
.
It throws an invalid_argument
exception if aFlag
is not found.
BCBase
Definition at line 470 of file BCHandler.cpp.
|
private |
Sum the M_offset to boundary conditions offsets.
Definition at line 486 of file BCHandler.cpp.
|
private |
true only if the bcUpdate has been done
Definition at line 541 of file BCHandler.hpp.
|
private |
vector list holding the stored BCs
Definition at line 544 of file BCHandler.hpp.
|
private |
offset
Definition at line 547 of file BCHandler.hpp.
|
private |
set of markers which are in the mesh but not in the list
Definition at line 550 of file BCHandler.hpp.