Loading...
Searching...
No Matches
system_solvers_large.tpp
1/*---------------------------------------------------------------------------*\
2 *
3 * bitpit
4 *
5 * Copyright (C) 2015-2021 OPTIMAD engineering Srl
6 *
7 * -------------------------------------------------------------------------
8 * License
9 * This file is part of bitpit.
10 *
11 * bitpit is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License v3 (LGPL)
13 * as published by the Free Software Foundation.
14 *
15 * bitpit is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 * License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with bitpit. If not, see <http://www.gnu.org/licenses/>.
22 *
23\*---------------------------------------------------------------------------*/
24
25#ifndef __BITPIT_SYSTEM_SOLVERS_LARGE_TPP__
26#define __BITPIT_SYSTEM_SOLVERS_LARGE_TPP__
27
28namespace bitpit {
29
47template<typename RowRankStorage, typename ColRankStorage>
49 const ColRankStorage *colRankStorage)
50 : m_rowRankStorage(rowRankStorage), m_colRankStorage(colRankStorage)
51{
52}
53
64template<typename RowRankStorage, typename ColRankStorage>
66{
67 return (*m_rowRankStorage)[row];
68}
69
80template<typename RowRankStorage, typename ColRankStorage>
82{
83 return (*m_colRankStorage)[col];
84}
85
94template<typename DerivedSystemSolver>
95void SystemSolver::assembly(const typename DerivedSystemSolver::Assembler &assembler,
96 const SystemMatrixOrdering &reordering)
97{
98 // Clear the system
99 clear();
100
101 // Set reordering
102 setReordering(assembler.getRowCount(), assembler.getColCount(), reordering);
103
104#if BITPIT_ENABLE_MPI == 1
105 // Set the communicator
106 setCommunicator(assembler.getCommunicator());
107
108 // Detect if the system is partitioned
109 m_partitioned = assembler.isPartitioned();
110#endif
111
112 // Assemble matrix
113 static_cast<DerivedSystemSolver &>(*this).matrixAssembly(assembler);
114
115 // Initialize RHS and solution vectors
117
118 // The system is now assembled
119 m_assembled = true;
120
121 // Initialize KSP options
123
124 // Initialize KSP statuses
126}
127
138template<typename DerivedSystemSolver>
139void SystemSolver::update(long nRows, const long *rows, const typename DerivedSystemSolver::Assembler &assembler)
140{
141 // Check if the system is assembled
142 if (!isAssembled()) {
143 throw std::runtime_error("Unable to update the system. The system is not yet assembled.");
144 }
145
146 // Update matrix
147 static_cast<DerivedSystemSolver &>(*this).matrixUpdate(nRows, rows, assembler);
148}
149
150}
151
152#endif
long getRowPermutationRank(long row) const override
long getColPermutationRank(long col) const override
ProxySystemMatrixOrdering(const RowRankStorage *rowRankStorage, const ColRankStorage *colRankStorage)
The SystemMatrixOrdering class provides an interface for defining classes that allows to reorder the ...
void setReordering(long nRows, long nCols, const SystemMatrixOrdering &reordering)
void assembly(const SparseMatrix &matrix)
--- layout: doxygen_footer ---