OGS
PETScTools.cpp
Go to the documentation of this file.
1
16
17#include "PETScTools.h"
18
19namespace MathLib
20{
22 const std::vector<PetscInt>& vec_knownX_id,
23 const std::vector<PetscScalar>& vec_knownX_x,
24 DirichletBCApplicationMode const /*mode*/)
25{
27
28#ifndef NDEBUG
29 if (std::any_of(vec_knownX_id.begin(), vec_knownX_id.end(),
30 [](PetscInt const i) { return i < 0; }))
31 {
33 "Found negative indices in the vector of Dirichlet boundary "
34 "conditions.");
35 }
36#endif // NDEBUG
37
38 A.setRowsColumnsZero(vec_knownX_id);
40
43 if (vec_knownX_id.size() > 0)
44 {
45 x.set(vec_knownX_id, vec_knownX_x);
46 b.set(vec_knownX_id, vec_knownX_x);
47 }
48
51}
52
53} // end of namespace MathLib
#define OGS_FATAL(...)
Definition Error.h:26
Declaration of a function related to PETSc solver interface to assign the Dirichlet boundary conditio...
Wrapper class for PETSc matrix routines for matrix.
Definition PETScMatrix.h:32
void finalizeAssembly(const MatAssemblyType asm_type=MAT_FINAL_ASSEMBLY)
Perform MPI collection of assembled entries in buffer.
Definition PETScMatrix.h:67
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:41
void finalizeAssembly()
Perform MPI collection of assembled entries in buffer.
void set(const PetscInt i, const PetscScalar value)
DirichletBCApplicationMode
Definition LinAlgEnums.h:42
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)