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::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 (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 (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 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 171 of file AssemblyMixin.cpp.

176{
177 for (std::size_t variable_id = 0; variable_id < residuum_vectors.size();
178 ++variable_id)
179 {
181 rhs, variable_id, local_to_global_index_map,
182 residuum_vectors[variable_id].get(), std::negate<double>());
183 }
184}
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 >::assembleGeneric().

◆ copyResiduumVectorsToSubmesh()

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

Definition at line 186 of file AssemblyMixin.cpp.

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

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 60 of file AssemblyMixin.cpp.

66{
67 DBUG("AssemblyMixinBase initializeSubmeshOutput().");
68
69 auto const num_residua = residuum_names.size();
70
71 if (pvs.size() != num_residua)
72 {
74 "The number of passed residuum names does not match the number "
75 "of process variables for process id {}: {} != {}",
76 process_id, num_residua, pvs.size());
77 }
78
79 submesh_assembly_data_.reserve(submeshes.size());
80 for (auto& mesh_ref : submeshes)
81 {
82 auto& mesh = mesh_ref.get();
83
84 submesh_assembly_data_.emplace_back(
85 mesh, createResiduumVectors(mesh, residuum_names, pvs));
86 }
87
89 createResiduumVectors(bulk_mesh, residuum_names, pvs);
90}
#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::Process const & process)
protected

Definition at line 92 of file AssemblyMixin.cpp.

93{
94 DBUG("AssemblyMixin updateActiveElements().");
95
97 {
99 return;
100 }
101
102 ActiveElementIDsState const new_state =
103 process.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(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 123 of file AssemblyMixin.cpp.

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

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