OGS
ProcessLib::AssemblyMixinBase Class Reference

Detailed Description

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

Definition at line 41 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 (MeshLib::Mesh &bulk_mesh, std::vector< std::reference_wrapper< MeshLib::Mesh > > const &submeshes, std::vector< std::vector< std::string > > const &residuum_names, std::vector< std::vector< std::reference_wrapper< ProcessVariable > > > const &pvs)
 
void updateActiveElements (ProcessLib::Process const &process)
 

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 (int const process_id, GlobalVector const &rhs, NumLib::LocalToGlobalIndexMap const &local_to_global_index_map, SubmeshAssemblyData const &sad)
 

Protected Attributes

std::vector< SubmeshAssemblyDatasubmesh_assembly_data_
 
std::vector< 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 (Process const &process)
 

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 51 of file AssemblyMixin.h.

52 : 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 215 of file AssemblyMixin.cpp.

220{
221 for (std::size_t variable_id = 0; variable_id < residuum_vectors.size();
222 ++variable_id)
223 {
225 rhs, variable_id, local_to_global_index_map,
226 residuum_vectors[variable_id].get(), std::negate<double>());
227 }
228}
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:59

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

◆ copyResiduumVectorsToSubmesh()

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

Definition at line 230 of file AssemblyMixin.cpp.

235{
236 auto const& residuum_vectors = sad.residuum_vectors[process_id];
237 for (std::size_t variable_id = 0; variable_id < residuum_vectors.size();
238 ++variable_id)
239 {
241 rhs, variable_id, local_to_global_index_map,
242 residuum_vectors[variable_id].get(), sad.bulk_node_ids,
243 std::negate<double>());
244 }
245}

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

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

◆ initializeAssemblyOnSubmeshes()

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

Definition at line 114 of file AssemblyMixin.cpp.

120{
121 DBUG("AssemblyMixinBase initializeSubmeshOutput().");
122
123 submesh_assembly_data_.reserve(submeshes.size());
124 for (auto& mesh_ref : submeshes)
125 {
126 auto& mesh = mesh_ref.get();
127
128 submesh_assembly_data_.emplace_back(
129 mesh, createResiduumVectors(mesh, residuum_names, pvs));
130 }
131
133 createResiduumVectors(bulk_mesh, residuum_names, pvs);
134}
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
std::vector< SubmeshAssemblyData > submesh_assembly_data_
std::vector< std::vector< std::reference_wrapper< MeshLib::PropertyVector< double > > > > residuum_vectors_bulk_
std::vector< std::vector< std::reference_wrapper< MeshLib::PropertyVector< double > > > > createResiduumVectors(MeshLib::Mesh &mesh, std::vector< std::vector< std::string > > const &per_process_residuum_names, std::vector< std::vector< std::reference_wrapper< ProcessLib::ProcessVariable > > > const &per_process_pvs)

References DBUG(), residuum_vectors_bulk_, and submesh_assembly_data_.

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

◆ updateActiveElements()

void ProcessLib::AssemblyMixinBase::updateActiveElements ( ProcessLib::Process const & process)
protected

Definition at line 136 of file AssemblyMixin.cpp.

137{
138 DBUG("AssemblyMixin updateActiveElements().");
139
141 {
143 return;
144 }
145
146 ActiveElementIDsState const new_state =
147 process.getActiveElementIDs().empty()
150
153 {
154 // no update necessary
155 return;
156 }
157
158 // updating the active elements is necessary in all remaining cases, because
159 // of the following transitions between old and new states (deactivated
160 // subdomains present? yes/no; old state -> new state):
161 // * no -> yes - now there are deactivated subdomains
162 // * yes -> no - no deactivated subdomains anymore
163 // * yes -> yes - deactivated subdomains might have changed
165}
void updateActiveElementsImpl(Process const &process)
ActiveElementIDsState ids_state_

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

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

◆ updateActiveElementsImpl()

void ProcessLib::AssemblyMixinBase::updateActiveElementsImpl ( Process const & process)
private

Definition at line 167 of file AssemblyMixin.cpp.

168{
169 DBUG("AssemblyMixinBase updateActiveElementsImpl().");
170
171 auto const& active_element_ids = process.getActiveElementIDs();
172
173 ActiveElementIDsState const new_state =
174 active_element_ids.empty()
177
179 {
180 // no deactivated subdomains, assemble on all elements as specified
181 // in the bulk_element_ids of the submeshes
182 for (auto& sad : submesh_assembly_data_)
183 {
184 // note: this copies the ID vector!
185 sad.active_element_ids = sad.bulk_element_ids;
186 }
187 }
188 else
189 {
190 // assemble each submesh on the intersection of the "global" active
191 // elements and the submesh
192 std::unordered_set<std::size_t> active_element_ids_set(
193 active_element_ids.begin(), active_element_ids.end());
194
195 for (auto& sad : submesh_assembly_data_)
196 {
197 auto& aeis = sad.active_element_ids;
198 auto& beis = sad.bulk_element_ids;
199 aeis.clear();
200 aeis.reserve(beis.getNumberOfTuples());
201
202 for (auto bei : beis)
203 {
204 if (active_element_ids_set.contains(bei))
205 {
206 aeis.push_back(bei);
207 }
208 }
209 }
210 }
211
212 ids_state_ = new_state;
213}

References DBUG(), ProcessLib::Process::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 85 of file AssemblyMixin.h.

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

◆ ids_state_

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

Definition at line 90 of file AssemblyMixin.h.

Referenced by updateActiveElements(), and updateActiveElementsImpl().

◆ pvma_

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

◆ residuum_vectors_bulk_

std::vector< 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: