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 std::cerr <<
"[ElementManager]: Grid initialization failed, no matrix size could be retrived!\n";
68 throw std::runtime_error(
static_cast<std::string
>(
"[ElementManager]: Grid initialization failed, no matrix size could be retrived!"));
86 <<
"[ElementManager]: Non-supported mixing of dense and sparse matrix types!\nPleas use "
87 "either just dense or just sparse matrices for the global matrices.\n";
88 throw std::runtime_error(
89 "[ElementManager]: Non-supported mixing of dense and sparse matrix types!\nPleas use "
90 "either just dense or just sparse matrices for the global matrices.");
92 m_forcing_vector.resize(
size);
93 sortCells(all_cells,
size);
115 cell_ptr->registerElementsCsr(*m_capacitance_matrix, *m_stiffness_matrix);
120 boundary_ptr->registerElementsCsr(*m_capacitance_matrix, *m_stiffness_matrix);
132 <<
"[ElementManager] Non-supported mixing of dense and sparse matrix types!\nPleas use "
133 "either just dense or just sparse matrices for the global matrices.\n";
134 throw std::runtime_error(
135 "[ElementManager] Non-supported mixing of dense and sparse matrix types!\nPleas use "
136 "either just dense or just sparse matrices for the global matrices.\n");
141 cell_ptr->getReferenceToElements(*m_capacitance_matrix, *m_stiffness_matrix,
147 boundary_ptr->getReferenceToElements(*m_capacitance_matrix, *m_stiffness_matrix,
150 m_boundary_cells.push_back(std::move(
cell_ptr));
156 m_interior_cells.push_back(std::move(
cell_ptr));
171 sortCells(all_cells);
181 m_stiffness_matrix->zeroMatrix();
182 m_capacitance_matrix->zeroMatrix();
183 m_forcing_vector *= 0;
Concrete implementation of a matrix class representing a Compressed Sparse Rows (CSR) matrix....
Definition CsrMatrix.h:37
void buildAtRuntime()
Builds the CSR matrix from the registered elements. It sorts all elements of the COO format vector by...
Definition CsrMatrix.h:147
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:169
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:191
std::pair< int, int > size() const
Function that returns the size of the matrix as a pair in (rows, columns) format.
Definition GenericMatrix.h:120