1#ifndef ELEMENT_MANAGER_H
2#define ELEMENT_MANAGER_H
22 std::vector<std::unique_ptr<GenericElement<T>>> m_interior_cells{};
23 std::vector<std::unique_ptr<GenericElement<T>>> m_boundary_cells{};
25 void sortCells(std::vector<std::unique_ptr<
GenericElement<T>>>& all_cells,
int size);
67 throw std::runtime_error(
"Grid initialization failed, no matrix size could be retrived!\n");
77 m_capacitance_matrix->buildAtRuntime(size, size);
78 m_stiffness_matrix->buildAtRuntime(size, size);
85 <<
"[ElementManager] Non-supported mixing of dense and sparse matrix types!\nPleas use "
86 "either just dense or just sparse matrices for the global matrices.\n";
87 throw std::runtime_error(
88 "[ElementManager] Non-supported mixing of dense and sparse matrix types!\nPleas use "
89 "either just dense or just sparse matrices for the global matrices.\n");
91 m_forcing_vector.resize(size);
92 sortCells(all_cells, size);
114 cell_ptr->registerElementsCsr(*m_capacitance_matrix, *m_stiffness_matrix);
119 boundary_ptr->registerElementsCsr(*m_capacitance_matrix, *m_stiffness_matrix);
123 m_capacitance_matrix->buildAtRuntime(
dim,
dim);
124 m_stiffness_matrix->buildAtRuntime(
dim,
dim);
131 <<
"[ElementManager] Non-supported mixing of dense and sparse matrix types!\nPleas use "
132 "either just dense or just sparse matrices for the global matrices.\n";
133 throw std::runtime_error(
134 "[ElementManager] Non-supported mixing of dense and sparse matrix types!\nPleas use "
135 "either just dense or just sparse matrices for the global matrices.\n");
140 cell_ptr->getReferenceToElements(*m_capacitance_matrix, *m_stiffness_matrix,
146 boundary_ptr->getReferenceToElements(*m_capacitance_matrix, *m_stiffness_matrix,
149 m_boundary_cells.push_back(std::move(
cell_ptr));
155 m_interior_cells.push_back(std::move(
cell_ptr));
170 sortCells(all_cells);
180 m_stiffness_matrix->zeroMatrix();
181 m_capacitance_matrix->zeroMatrix();
182 m_forcing_vector *= 0;
Error class to throw when a module chain has circular or missing dependencies. Inherits from std::exc...
Definition ChainManager.h:28
Class that manages the building of the global capacitance and stiffness matrix and forcing vector fro...
Definition ElementManager.h:20
ElementManager(int size, std::shared_ptr< MatrixFactory< T > > matrix_factory)
Constructor for cases, where the cell list will be set later.
Definition ElementManager.h:46
std::shared_ptr< GenericMatrix< T > > m_capacitance_matrix
Definition ElementManager.h:30
std::valarray< T > m_forcing_vector
Definition ElementManager.h:32
void setCells(std::vector< std::unique_ptr< GenericElement< T > > > &all_cells)
Does the cell sorting for the cases where the ElementManager has been default constructed.
Definition ElementManager.h:168
std::shared_ptr< GenericMatrix< T > > m_stiffness_matrix
Definition ElementManager.h:31
void assembleFemMatrices()
Calls all the element matrix creation function to assemble the global FEM matrices and vectors.
Definition ElementManager.h:190