MoReFEM
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Data Fields | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends
MoReFEM::DirichletBoundaryCondition Class Referencefinal

Class in charge of Dirichlet boundary conditions. More...

#include <DirichletBoundaryCondition.hpp>

Inheritance diagram for MoReFEM::DirichletBoundaryCondition:
Collaboration diagram for MoReFEM::DirichletBoundaryCondition:

Public Types

using shared_ptr = std::shared_ptr<DirichletBoundaryCondition>
 Shared smart pointer.
 
using vector_shared_ptr = std::vector<shared_ptr>
 Vector of smart pointers.
 
using underlying_type
 Type used for the unique id.
 

Public Member Functions

const UnknownGetUnknown () const noexcept
 Unknown considered in the boundary condition.
 
const DomainGetDomain () const noexcept
 Domain upon which the condition is applied.
 
const Dof::vector_shared_ptrGetDofList () const noexcept
 Access to the list of Dofs encompassed by the Dirichlet boundary condition.
 
bool IsNumberingSubset (const NumberingSubset &numbering_subset) const
 Whether a given numbering subset is relevant for the boundary condition.
 
void UpdateValues (const GlobalVector &new_values)
 Replace the values to apply on dofs by the ones given in new_values.
 
void UpdateValues (const NumberingSubset &numbering_subset, std::vector< PetscScalar > &&new_values)
 Replace the values to apply on dofs by the ones given in new_values for numbering subset.
 
BoundaryConditionNS::unique_id GetUniqueId () const
 Get the value of the internal unique ID.
 

Static Public Member Functions

static const std::string & ClassName ()
 Class name.
 
static BoundaryConditionNS::unique_id GenerateNewEligibleId ()
 Generate a unique id.
 
static void ClearUniqueIdList ()
 Clear all unique ids.
 

Data Fields

friend GodOfDof
 Friendship to GodOfDof, which is the only allowed to call some of the private methods.
 

Private Types

using unique_id_parent
 Alias to parent.
 

Private Member Functions

void Reduce (const NodeBearer::vector_shared_ptr &processor_wise_node_bearer_list, const NodeBearer::vector_shared_ptr &ghost_node_bearer_list)
 Reduce: keep only NodeBearer that are either processor-wise or ghost.
 
const NodeBearer::vector_shared_ptrSetNodeBearerList (NodeBearer::vector_shared_ptr &&node_bearer_list)
 Set the list of NodeBearer.
 
const NodeBearer::vector_shared_ptrGetNodeBearerList () const noexcept
 Get the list of NodeBearer.
 
NodeBearer::vector_shared_ptrGetNonCstNodeBearerList () noexcept
 Get the list of NodeBearer.
 
Dof::vector_shared_ptrGetNonCstDofList () noexcept
 Non constant access to the list of Dofs encompassed by the Dirichlet boundary condition.
 
const std::vector< std::pair< NumberingSubsetNS::unique_id, Internal::BoundaryConditionNS::DofStorage > > & GetDofStorage () const noexcept
 Constant accessor to Storage of dof for all numbering subsets

.
 
std::vector< std::pair< NumberingSubsetNS::unique_id, Internal::BoundaryConditionNS::DofStorage > > & GetNonCstDofStorage () noexcept
 Non constant accessor to Storage of dof for all numbering subsets

.
 
const Internal::BoundaryConditionNS::DofStorageGetDofStorage (const NumberingSubset &numbering_subset) const noexcept
 
Internal::BoundaryConditionNS::DofStorageGetNonCstDofStorage (const NumberingSubset &numbering_subset) noexcept
 
const std::vector< std::pair< Dof::shared_ptr, double > > & GetInitialDofValueList () const noexcept
 Accessor to the dof and their associated values.
 
std::vector< std::pair< Dof::shared_ptr, double > > & GetNonCstInitialDofValueList () noexcept
 Non constant accessor to the dof and their associated values.
 
void ClearInitialDofValueList ()
 Clear the initial values storage.
 
Methods to be called by friend GodOfDof.
void ShrinkToProcessorWise (const GodOfDof &god_of_dof)
 Keep only the dofs that are related to current processor (i.e. either processor-wise or ghost).
 
void SetDofListForNumberingSubset (const NumberingSubset &numbering_subset, Dof::vector_shared_ptr &&dof_list)
 Fill properly the storage for a given numbering_subset.
 
void ConsiderNumberingSubset (const NumberingSubset &numbering_subset)
 Tell a numbering subset is relevant for the boundary condition, even if not present processor-wisely.
 
void ComputeDofList ()
 Compute the list of dofs and their associated values.
 
const Internal::BoundaryConditionNS::ComponentManagerGetComponentManager () const noexcept
 Access to component manager.
 
double GetValueForComponent (Advanced::ComponentNS::index_type component) const
 Return the value of the requested boundary condition.
 

Static Private Member Functions

static BoundaryConditionNS::unique_id AssignUniqueId ()
 If AssignationMode is automatic, generates a new unique identifier.
 
static BoundaryConditionNS::unique_id NewUniqueId (BoundaryConditionNS::unique_id new_unique_id)
 If AssignationMode is manual, checks the unique identifier provided is valid.
 
static std::set< BoundaryConditionNS::unique_id > & StaticUniqueIdList ()
 List of all identifiers existing for DerivedT.
 

Private Attributes

const Domaindomain_
 Domain upon which the condition is applied.
 
const Unknownunknown_
 variable concerned by this DirichletBoundaryCondition
 
Internal::BoundaryConditionNS::ComponentManager::const_shared_ptr component_manager_ = nullptr
 Object which can tell which components are encompassed by the boundary condition.
 
std::vector< std::pair< Dof::shared_ptr, double > > initial_dof_value_list_
 Initial values associated to each dof.
 
NodeBearer::vector_shared_ptr node_bearer_list_
 List of all NodeBearer encompassed by the boundary condition.
 
Dof::vector_shared_ptr dof_list_
 List of all dofs encompassed by the boundary condition.
 
std::vector< double > penalization_array_
 Helpful vector when penalization is to be used, which stores the penalization value for each dof.
 
std::vector< std::pair< NumberingSubsetNS::unique_id, Internal::BoundaryConditionNS::DofStorage > > dof_storage_per_numbering_subset_
 For each numbering subset, store the relevant information about the dofs involved in the boundary condition.
 
std::vector< double > value_per_component_
 Initial value per component (should not be stored past #619).
 
bool is_dof_list_computed_ = false
 Whether the dof list has been properly computed or not (through a call to ComputeDofList().
 
bool is_cleared_ = false
 Whether ClearInitialDofValueList() has already been called or not.
 
bool is_mutable_ = false
 Whether the values may vary over time.
 
const BoundaryConditionNS::unique_id unique_id_
 The value of the unique id for the current DerivedT object.
 

Friends

void ClearAllBoundaryConditionInitialValueList ()
 Friendship to the manager, that will erase some temporary data.
 

Special members.

 DirichletBoundaryCondition (BoundaryConditionNS::unique_id unique_id, const Domain &domain, const Unknown &unknown, const std::vector< double > &value_per_component, const std::string &component, bool is_mutable)
 Constructor.
 
 ~DirichletBoundaryCondition ()=default
 Destructor.
 
 DirichletBoundaryCondition (const DirichletBoundaryCondition &rhs)=delete
 The copy constructor.
 
 DirichletBoundaryCondition (DirichletBoundaryCondition &&rhs)=delete
 The move constructor.
 
DirichletBoundaryConditionoperator= (const DirichletBoundaryCondition &rhs)=delete
 The (copy) operator=.
 
DirichletBoundaryConditionoperator= (DirichletBoundaryCondition &&rhs)=delete
 The (move) operator=.
 

Detailed Description

Class in charge of Dirichlet boundary conditions.

This class is still relatively close to its counterpart in Felisce; a move heavy refactoring is not excluded at all.

Member Typedef Documentation

◆ unique_id_parent

Initial value:
Crtp::
UniqueId<DirichletBoundaryCondition, BoundaryConditionNS::unique_id, UniqueIdNS::AssignationMode::manual>

Alias to parent.

Friendship to Manager class.

Constructor & Destructor Documentation

◆ DirichletBoundaryCondition() [1/3]

MoReFEM::DirichletBoundaryCondition::DirichletBoundaryCondition ( BoundaryConditionNS::unique_id unique_id,
const Domain & domain,
const Unknown & unknown,
const std::vector< double > & value_per_component,
const std::string & component,
bool is_mutable )
explicitprivate

Constructor.

Parameters
[in]unique_idUnique identifier, used in the input data file to tag the condition.
[in]domainDomain upon which the condition is applied.
[in]unknownUnknown considered for the boundary condition. If you actually want a condition on a given domain that acts upon two unknowns, you must define another DirichletBoundaryCondition; both should be given in the dedicated VariationaFormulation.
[in]value_per_componentInitial value for each of the component.
[in]componentString that details on which component the condition should be applied. This string must be one recognized by the ComponentFactory; current choices are 'Comp1', 'Comp2', 'Comp3', 'Comp12', 'Comp23', 'Comp13' and 'Comp123'.
[in]is_mutableFalse if the boundary condition is homogeneous, true otherwise.

◆ DirichletBoundaryCondition() [2/3]

MoReFEM::DirichletBoundaryCondition::DirichletBoundaryCondition ( const DirichletBoundaryCondition & rhs)
delete

The copy constructor.

Parameters
[in]rhsThe object from which the construction occurs.

◆ DirichletBoundaryCondition() [3/3]

MoReFEM::DirichletBoundaryCondition::DirichletBoundaryCondition ( DirichletBoundaryCondition && rhs)
delete

The move constructor.

Parameters
[in]rhsThe object from which the construction occurs.

Member Function Documentation

◆ operator=() [1/2]

DirichletBoundaryCondition & MoReFEM::DirichletBoundaryCondition::operator= ( const DirichletBoundaryCondition & rhs)
delete

The (copy) operator=.

Parameters
[in]rhsThe object from which the affectation occurs.
Returns
Reference to the object (to enable chained affectation).

◆ operator=() [2/2]

DirichletBoundaryCondition & MoReFEM::DirichletBoundaryCondition::operator= ( DirichletBoundaryCondition && rhs)
delete

The (move) operator=.

Parameters
[in]rhsThe object from which the affectation occurs.
Returns
Reference to the object (to enable chained affectation).

◆ IsNumberingSubset()

bool MoReFEM::DirichletBoundaryCondition::IsNumberingSubset ( const NumberingSubset & numbering_subset) const

Whether a given numbering subset is relevant for the boundary condition.

The relevancy is here program-wise: it might return true even if no dofs are managed by the current processor.

Parameters
[in]numbering_subsetNumbering subset considered.
Returns
Whether boundary condition is related to numbering_subset.

◆ UpdateValues() [1/2]

void MoReFEM::DirichletBoundaryCondition::UpdateValues ( const GlobalVector & new_values)

Replace the values to apply on dofs by the ones given in new_values.

Parameters
[in]new_valuesGlobal vector from which new boundaruy condition values should be extracted.
Attention
All numbering subsets are updated if they share some of the dofs involved.

◆ UpdateValues() [2/2]

void MoReFEM::DirichletBoundaryCondition::UpdateValues ( const NumberingSubset & numbering_subset,
std::vector< PetscScalar > && new_values )

Replace the values to apply on dofs by the ones given in new_values for numbering subset.

Parameters
[in]new_valuesGlobal vector from which new boundaruy condition values should be extracted.
Attention
All numbering subsets are updated if they share some of the dofs involved.
Parameters
[in]numbering_subsetNumbering subset considered.

◆ ShrinkToProcessorWise()

void MoReFEM::DirichletBoundaryCondition::ShrinkToProcessorWise ( const GodOfDof & god_of_dof)
private

Keep only the dofs that are related to current processor (i.e. either processor-wise or ghost).

Should be called only by GodOfDof.

Parameters
[in]god_of_dofGod of dof that possess the dofs considered in the boundary condition.

◆ SetDofListForNumberingSubset()

void MoReFEM::DirichletBoundaryCondition::SetDofListForNumberingSubset ( const NumberingSubset & numbering_subset,
Dof::vector_shared_ptr && dof_list )
private

Fill properly the storage for a given numbering_subset.

Should be called only by GodOfDof.

Parameters
[in]numbering_subsetNumberingSubset considered.
[in]dof_listDof list to associate to numbering_subset.

◆ ConsiderNumberingSubset()

void MoReFEM::DirichletBoundaryCondition::ConsiderNumberingSubset ( const NumberingSubset & numbering_subset)
private

Tell a numbering subset is relevant for the boundary condition, even if not present processor-wisely.

Should be called only by GodOfDof.

Parameters
[in]numbering_subsetNumberingSubset to consider.

◆ ComputeDofList()

void MoReFEM::DirichletBoundaryCondition::ComputeDofList ( )
private

Compute the list of dofs and their associated values.

Should be called only by GodOfDof.

◆ GetComponentManager()

const Internal::BoundaryConditionNS::ComponentManager & MoReFEM::DirichletBoundaryCondition::GetComponentManager ( ) const
privatenoexcept

Access to component manager.

Should be called only by GodOfDof.

Returns
Component manager.

◆ GetValueForComponent()

double MoReFEM::DirichletBoundaryCondition::GetValueForComponent ( Advanced::ComponentNS::index_type component) const
private

Return the value of the requested boundary condition.

Parameters
[in]componentIndex of the active component considered. If for instance Comp13, component = 0 will yield x and component = 1 will yield z.
Returns
Value of the boundary condition for component -th component.

◆ Reduce()

void MoReFEM::DirichletBoundaryCondition::Reduce ( const NodeBearer::vector_shared_ptr & processor_wise_node_bearer_list,
const NodeBearer::vector_shared_ptr & ghost_node_bearer_list )
private

Reduce: keep only NodeBearer that are either processor-wise or ghost.

Parameters
[in]processor_wise_node_bearer_listList of processor-wise NodeBearer in the GodOfDof for which current method is called.
[in]ghost_node_bearer_listList of ghost NodeBearer in the GodOfDof for which current method is called.

◆ SetNodeBearerList()

const NodeBearer::vector_shared_ptr & MoReFEM::DirichletBoundaryCondition::SetNodeBearerList ( NodeBearer::vector_shared_ptr && node_bearer_list)
private

Set the list of NodeBearer.

Parameters
[in]node_bearer_listThe list of NodeBearer considered.
Returns
The NodeBearer list.

The return value is the same content as the argument: it is a trick so that rvalue ay be used to initialise the list.

◆ GetDofStorage() [1/2]

const std::vector< std::pair< NumberingSubsetNS::unique_id, Internal::BoundaryConditionNS::DofStorage > > & MoReFEM::DirichletBoundaryCondition::GetDofStorage ( ) const
privatenoexcept

Constant accessor to Storage of dof for all numbering subsets

.

Returns
Storage of dof for all numbering subsets.

◆ GetNonCstDofStorage() [1/2]

std::vector< std::pair< NumberingSubsetNS::unique_id, Internal::BoundaryConditionNS::DofStorage > > & MoReFEM::DirichletBoundaryCondition::GetNonCstDofStorage ( )
privatenoexcept

Non constant accessor to Storage of dof for all numbering subsets

.

Returns
Reference to Storage of dof for all numbering subsets.

◆ GetDofStorage() [2/2]

const Internal::BoundaryConditionNS::DofStorage & MoReFEM::DirichletBoundaryCondition::GetDofStorage ( const NumberingSubset & numbering_subset) const
privatenoexcept

Access to the storage of dof for a given numbering subset.

Parameters
[in]numbering_subsetNumberingSubset used as filter.

◆ GetNonCstDofStorage() [2/2]

Internal::BoundaryConditionNS::DofStorage & MoReFEM::DirichletBoundaryCondition::GetNonCstDofStorage ( const NumberingSubset & numbering_subset)
privatenoexcept

Non constant access to the storage of dof for a given numbering subset.

Parameters
[in]numbering_subsetNumberingSubset used as filter.

◆ GetUniqueId()

BoundaryConditionNS::unique_id MoReFEM::Crtp::UniqueId< DirichletBoundaryCondition , BoundaryConditionNS::unique_id , AssignationModeT, UniqueIdNS::DoAllowNoId::no >::GetUniqueId ( ) const
inherited

Get the value of the internal unique ID.

Returns
Unique id.

◆ GenerateNewEligibleId()

static BoundaryConditionNS::unique_id MoReFEM::Crtp::UniqueId< DirichletBoundaryCondition , BoundaryConditionNS::unique_id , AssignationModeT, UniqueIdNS::DoAllowNoId::no >::GenerateNewEligibleId ( )
staticinherited

Generate a unique id.

No new objects is created, and the new identifier is not counted in the list - the purpose here is just to provide a value that don't collide with existing objects. This is really used in a very edge case; think twice before using this functionality as it really might not be what you really seek.

Returns
A unique id that is not in use yet.

◆ ClearUniqueIdList()

static void MoReFEM::Crtp::UniqueId< DirichletBoundaryCondition , BoundaryConditionNS::unique_id , AssignationModeT, UniqueIdNS::DoAllowNoId::no >::ClearUniqueIdList ( )
staticinherited

Clear all unique ids.

Attention
This functionality has been put there only for the sake of writing tests; please do not use it! It should be considered as private, even if unfortunately I can't easily put it that way.

◆ AssignUniqueId()

static BoundaryConditionNS::unique_id MoReFEM::Crtp::UniqueId< DirichletBoundaryCondition , BoundaryConditionNS::unique_id , AssignationModeT, UniqueIdNS::DoAllowNoId::no >::AssignUniqueId ( )
staticprivateinherited

If AssignationMode is automatic, generates a new unique identifier.

Returns
The new unique id, which is just an increment from the previously assigned one.

◆ NewUniqueId()

static BoundaryConditionNS::unique_id MoReFEM::Crtp::UniqueId< DirichletBoundaryCondition , BoundaryConditionNS::unique_id , AssignationModeT, UniqueIdNS::DoAllowNoId::no >::NewUniqueId ( BoundaryConditionNS::unique_id new_unique_id)
staticprivateinherited

If AssignationMode is manual, checks the unique identifier provided is valid.

Parameters
[in]new_unique_idThe proposed new unique id. If it already exists an exception will be thrown.
Returns
The unmodified unique id.

Friends And Related Symbol Documentation

◆ ClearAllBoundaryConditionInitialValueList

void ClearAllBoundaryConditionInitialValueList ( )
friend

Friendship to the manager, that will erase some temporary data.

At the beginning of a model, boundary conditions are initialized with a value read in the input data file. This value is retained for homogeneous boundary condition, and modified for other cases; whichever the case the initial value is not needed anymore, as the storage is different in all cases. So it's possible to spare (very few) memory by dropping now unused values.

Field Documentation

◆ initial_dof_value_list_

std::vector<std::pair<Dof::shared_ptr, double> > MoReFEM::DirichletBoundaryCondition::initial_dof_value_list_
private

Initial values associated to each dof.

[internal] When this data is created, dofs aren't yet given their program-wise index, so both std::map and std::unordered_map would be very unreliable here.

All dofs are considered here, regardless of their numbering subset.

Todo
#619 This container should disappear: if dofs are generated after the reduction to processor-wise the initial values can be retrieved in the same time and current container could hence be avoided.
Attention
This container is cleared once it has been used!

◆ penalization_array_

std::vector<double> MoReFEM::DirichletBoundaryCondition::penalization_array_
private

Helpful vector when penalization is to be used, which stores the penalization value for each dof.

This vector may be given directly to Petsc::Matrix::SetValues().

◆ dof_storage_per_numbering_subset_

std::vector<std::pair<NumberingSubsetNS::unique_id, Internal::BoundaryConditionNS::DofStorage> > MoReFEM::DirichletBoundaryCondition::dof_storage_per_numbering_subset_
private

For each numbering subset, store the relevant information about the dofs involved in the boundary condition.

Key is unique id of the numbering subset; value is the object that stored the information about the dofs.

Attention
The value might not include any dofs: the convention is that a boundary condition must get a numbering subset key as soon as it is relevant. So if for instance a boundary condition encompasses n dofs all stored on processor i, all processors will nonetheless get a pair in the present list, even if there are no associated dofs.

The documentation for this class was generated from the following file: