OGS
ProcessLib::AssemblyMixinBase Class Reference

Detailed Description

Provides basic functionality for the AssemblyMixin that does not require template parameters.

Definition at line 39 of file AssemblyMixin.h.

#include <AssemblyMixin.h>

Inheritance diagram for ProcessLib::AssemblyMixinBase:
[legend]
Collaboration diagram for ProcessLib::AssemblyMixinBase:
[legend]

Protected Member Functions

 AssemblyMixinBase (AbstractJacobianAssembler &jacobian_assembler)
 
void initializeAssemblyOnSubmeshes (const int process_id, MeshLib::Mesh &bulk_mesh, std::vector< std::reference_wrapper< MeshLib::Mesh > > const &submeshes, std::vector< std::string > const &residuum_names, std::vector< std::reference_wrapper< ProcessVariable > > const &pvs)
 
void updateActiveElements (ProcessLib::ProcessVariable const &pv)
 

Static Protected Member Functions

static void copyResiduumVectorsToBulkMesh (GlobalVector const &rhs, NumLib::LocalToGlobalIndexMap const &local_to_global_index_map, std::vector< std::reference_wrapper< MeshLib::PropertyVector< double > > > residuum_vectors)
 
static void copyResiduumVectorsToSubmesh (GlobalVector const &rhs, NumLib::LocalToGlobalIndexMap const &local_to_global_index_map, SubmeshAssemblyData const &sad)
 

Protected Attributes

std::vector< SubmeshAssemblyDatasubmesh_assembly_data_
 
std::vector< std::reference_wrapper< MeshLib::PropertyVector< double > > > residuum_vectors_bulk_
 
std::size_t b_submesh_id_ = 0
 ID of the b vector on submeshes, cf. NumLib::VectorProvider.
 
Assembly::ParallelVectorMatrixAssembler pvma_
 

Private Types

enum class  ActiveElementIDsState { UNINITIALIZED , HAS_DEACTIVATED_SUBDOMAINS , NO_DEACTIVATED_SUBDOMAINS }
 

Private Member Functions

void updateActiveElementsImpl (ProcessLib::ProcessVariable const &pv)
 

Private Attributes

ActiveElementIDsState ids_state_ = ActiveElementIDsState::UNINITIALIZED
 

Member Enumeration Documentation

◆ ActiveElementIDsState

Constructor & Destructor Documentation

◆ AssemblyMixinBase()

ProcessLib::AssemblyMixinBase::AssemblyMixinBase ( AbstractJacobianAssembler & jacobian_assembler)
inlineexplicitprotected

Definition at line 49 of file AssemblyMixin.h.

50 : pvma_{jacobian_assembler} {};
Assembly::ParallelVectorMatrixAssembler pvma_

Member Function Documentation

◆ copyResiduumVectorsToBulkMesh()

void ProcessLib::AssemblyMixinBase::copyResiduumVectorsToBulkMesh ( GlobalVector const & rhs,
NumLib::LocalToGlobalIndexMap const & local_to_global_index_map,
std::vector< std::reference_wrapper< MeshLib::PropertyVector< double > > > residuum_vectors )
staticprotected

Definition at line 172 of file AssemblyMixin.cpp.

177{
178 for (std::size_t variable_id = 0; variable_id < residuum_vectors.size();
179 ++variable_id)
180 {
182 rhs, variable_id, local_to_global_index_map,
183 residuum_vectors[variable_id].get(), std::negate<double>());
184 }
185}
void transformVariableFromGlobalVector(GlobalVector const &input_vector, int const variable_id, NumLib::LocalToGlobalIndexMap const &local_to_global_index_map, MeshLib::PropertyVector< double > &output_vector, Functor map_function)
auto & get(Tuples &... ts)
Definition Get.h:67

Referenced by ProcessLib::AssemblyMixin< Process >::assembleGeneric().

◆ copyResiduumVectorsToSubmesh()

void ProcessLib::AssemblyMixinBase::copyResiduumVectorsToSubmesh ( GlobalVector const & rhs,
NumLib::LocalToGlobalIndexMap const & local_to_global_index_map,
SubmeshAssemblyData const & sad )
staticprotected

Definition at line 187 of file AssemblyMixin.cpp.

191{
192 for (std::size_t variable_id = 0; variable_id < sad.residuum_vectors.size();
193 ++variable_id)
194 {
196 rhs, variable_id, local_to_global_index_map,
197 sad.residuum_vectors[variable_id].get(), sad.bulk_node_ids,
198 std::negate<double>());
199 }
200}

References ProcessLib::SubmeshAssemblyData::bulk_node_ids, and ProcessLib::SubmeshAssemblyData::residuum_vectors.

Referenced by ProcessLib::AssemblyMixin< Process >::assembleGeneric().

◆ initializeAssemblyOnSubmeshes()

void ProcessLib::AssemblyMixinBase::initializeAssemblyOnSubmeshes ( const int process_id,
MeshLib::Mesh & bulk_mesh,
std::vector< std::reference_wrapper< MeshLib::Mesh > > const & submeshes,
std::vector< std::string > const & residuum_names,
std::vector< std::reference_wrapper< ProcessVariable > > const & pvs )
protected

Definition at line 59 of file AssemblyMixin.cpp.

65{
66 DBUG("AssemblyMixinBase initializeSubmeshOutput().");
67
68 auto const num_residua = residuum_names.size();
69
70 if (pvs.size() != num_residua)
71 {
73 "The number of passed residuum names does not match the number "
74 "of process variables for process id {}: {} != {}",
75 process_id, num_residua, pvs.size());
76 }
77
78 submesh_assembly_data_.reserve(submeshes.size());
79 for (auto& mesh_ref : submeshes)
80 {
81 auto& mesh = mesh_ref.get();
82
83 submesh_assembly_data_.emplace_back(
84 mesh, createResiduumVectors(mesh, residuum_names, pvs));
85 }
86
88 createResiduumVectors(bulk_mesh, residuum_names, pvs);
89}
#define OGS_FATAL(...)
Definition Error.h:26
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
std::vector< std::reference_wrapper< MeshLib::PropertyVector< double > > > residuum_vectors_bulk_
std::vector< SubmeshAssemblyData > submesh_assembly_data_
std::vector< std::reference_wrapper< MeshLib::PropertyVector< double > > > createResiduumVectors(MeshLib::Mesh &mesh, std::vector< std::string > const &residuum_names, std::vector< std::reference_wrapper< ProcessLib::ProcessVariable > > pvs)

References DBUG(), OGS_FATAL, residuum_vectors_bulk_, and submesh_assembly_data_.

Referenced by ProcessLib::AssemblyMixin< Process >::initializeAssemblyOnSubmeshes().

◆ updateActiveElements()

void ProcessLib::AssemblyMixinBase::updateActiveElements ( ProcessLib::ProcessVariable const & pv)
protected

Definition at line 91 of file AssemblyMixin.cpp.

93{
94 DBUG("AssemblyMixinBase updateActiveElements().");
95
97 {
99 return;
100 }
101
102 ActiveElementIDsState const new_state =
103 pv.getActiveElementIDs().empty()
106
109 {
110 // no update necessary
111 return;
112 }
113
114 // updating the active elements is necessary in all remaining cases, because
115 // of the following transitions between old and new states (deactivated
116 // subdomains present? yes/no; old state -> new state):
117 // * no -> yes - now there are deactivated subdomains
118 // * yes -> no - no deactivated subdomains anymore
119 // * yes -> yes - deactivated subdomains might have changed
121}
void updateActiveElementsImpl(ProcessLib::ProcessVariable const &pv)
ActiveElementIDsState ids_state_

References DBUG(), ProcessLib::ProcessVariable::getActiveElementIDs(), HAS_DEACTIVATED_SUBDOMAINS, ids_state_, NO_DEACTIVATED_SUBDOMAINS, UNINITIALIZED, and updateActiveElementsImpl().

Referenced by ProcessLib::AssemblyMixin< Process >::updateActiveElements().

◆ updateActiveElementsImpl()

void ProcessLib::AssemblyMixinBase::updateActiveElementsImpl ( ProcessLib::ProcessVariable const & pv)
private

Definition at line 123 of file AssemblyMixin.cpp.

125{
126 DBUG("AssemblyMixinBase updateActiveElementsImpl().");
127
128 auto const& active_element_ids = pv.getActiveElementIDs();
129
130 ActiveElementIDsState const new_state =
131 active_element_ids.empty()
134
136 {
137 // no deactivated subdomains, assemble on all elements as specified
138 // in the bulk_element_ids of the submeshes
139 for (auto& sad : submesh_assembly_data_)
140 {
141 // note: this copies the ID vector!
142 sad.active_element_ids = sad.bulk_element_ids;
143 }
144 }
145 else
146 {
147 // assemble each submesh on the intersection of the "global" active
148 // elements and the submesh
149 std::unordered_set<std::size_t> active_element_ids_set(
150 active_element_ids.begin(), active_element_ids.end());
151
152 for (auto& sad : submesh_assembly_data_)
153 {
154 auto& aeis = sad.active_element_ids;
155 auto& beis = sad.bulk_element_ids;
156 aeis.clear();
157 aeis.reserve(beis.getNumberOfTuples());
158
159 for (auto bei : beis)
160 {
161 if (active_element_ids_set.contains(bei))
162 {
163 aeis.push_back(bei);
164 }
165 }
166 }
167 }
168
169 ids_state_ = new_state;
170}

References DBUG(), ProcessLib::ProcessVariable::getActiveElementIDs(), HAS_DEACTIVATED_SUBDOMAINS, ids_state_, NO_DEACTIVATED_SUBDOMAINS, and submesh_assembly_data_.

Referenced by updateActiveElements().

Member Data Documentation

◆ b_submesh_id_

std::size_t ProcessLib::AssemblyMixinBase::b_submesh_id_ = 0
protected

ID of the b vector on submeshes, cf. NumLib::VectorProvider.

Definition at line 81 of file AssemblyMixin.h.

Referenced by ProcessLib::AssemblyMixin< Process >::assembleGeneric().

◆ ids_state_

ActiveElementIDsState ProcessLib::AssemblyMixinBase::ids_state_ = ActiveElementIDsState::UNINITIALIZED
private

Definition at line 86 of file AssemblyMixin.h.

Referenced by updateActiveElements(), and updateActiveElementsImpl().

◆ pvma_

Assembly::ParallelVectorMatrixAssembler ProcessLib::AssemblyMixinBase::pvma_
protected

◆ residuum_vectors_bulk_

std::vector<std::reference_wrapper<MeshLib::PropertyVector<double> > > ProcessLib::AssemblyMixinBase::residuum_vectors_bulk_
protected

◆ submesh_assembly_data_

std::vector<SubmeshAssemblyData> ProcessLib::AssemblyMixinBase::submesh_assembly_data_
protected

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