OGS
PETScTools.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#include "PETScTools.h"
5
6#include "BaseLib/Error.h"
7
8namespace MathLib
9{
11 const std::vector<PetscInt>& vec_knownX_id,
12 const std::vector<PetscScalar>& vec_knownX_x,
13 DirichletBCApplicationMode const /*mode*/)
14{
16
17#ifndef NDEBUG
18 if (std::any_of(vec_knownX_id.begin(), vec_knownX_id.end(),
19 [](PetscInt const i) { return i < 0; }))
20 {
22 "Found negative indices in the vector of Dirichlet boundary "
23 "conditions.");
24 }
25#endif // NDEBUG
26
27 A.setRowsColumnsZero(vec_knownX_id);
29
32 if (vec_knownX_id.size() > 0)
33 {
34 x.set(vec_knownX_id, vec_knownX_x);
35 b.set(vec_knownX_id, vec_knownX_x);
36 }
37
40}
41
42} // end of namespace MathLib
#define OGS_FATAL(...)
Definition Error.h:19
Wrapper class for PETSc matrix routines for matrix.
Definition PETScMatrix.h:21
void finalizeAssembly(const MatAssemblyType asm_type=MAT_FINAL_ASSEMBLY)
Perform MPI collection of assembled entries in buffer.
Definition PETScMatrix.h:56
void setRowsColumnsZero(std::vector< PetscInt > const &row_pos)
Set the specified rows to zero except diagonal entries, i.e. , where This function must be called...
Wrapper class for PETSc vector.
Definition PETScVector.h:28
void finalizeAssembly()
Perform MPI collection of assembled entries in buffer.
void set(const PetscInt i, const PetscScalar value)
Definition PETScVector.h:92
DirichletBCApplicationMode
Definition LinAlgEnums.h:33
void applyKnownSolution(EigenMatrix &A, EigenVector &b, EigenVector &, const std::vector< EigenMatrix::IndexType > &vec_knownX_id, const std::vector< double > &vec_knownX_x, DirichletBCApplicationMode const mode)