9#ifndef ___AUX_FUNCTIONS_HPP__
10#define ___AUX_FUNCTIONS_HPP__
17 :
cOmm(m_field.get_comm()),
rAnk(m_field.get_comm_rank()) {}
34 int nb_locals =
rAnk == 0 ? 1 : 0;
35 int nb_ghosts =
rAnk > 0 ? 1 : 0;
36 CHKERR VecCreateGhost(
cOmm, nb_locals, 1, nb_ghosts, ghosts, ghost_vec);
46 CHKERR VecAssemblyBegin(ghost_vec);
47 CHKERR VecAssemblyEnd(ghost_vec);
49 CHKERR VecGhostUpdateBegin(ghost_vec, ADD_VALUES, SCATTER_REVERSE);
50 CHKERR VecGhostUpdateEnd(ghost_vec, ADD_VALUES, SCATTER_REVERSE);
52 CHKERR VecGhostUpdateBegin(ghost_vec, INSERT_VALUES, SCATTER_FORWARD);
53 CHKERR VecGhostUpdateEnd(ghost_vec, INSERT_VALUES, SCATTER_FORWARD);
64 CHKERR VecGetArray(ghost_vec, &e);
65 CHKERR PetscPrintf(
cOmm,
"Approximation error %4.3e\n", sqrt(e[0]));
66 CHKERR VecRestoreArray(ghost_vec, &e);
77 CHKERR VecGetArray(ghost_vec, &e);
79 const double eps = 1e-8;
80 if ((sqrt(e[0]) >
eps) || (!boost::math::isnormal(e[0]))) {
82 "Test failed, error too big");
84 CHKERR VecRestoreArray(ghost_vec, &e);
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_ATOM_TEST_INVALID
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
Deprecated interface functions.
MoFEMErrorCode createGhostVec(Vec *ghost_vec) const
MoFEMErrorCode testError(Vec ghost_vec)
Test error.
AuxFunctions(const MoFEM::Interface &m_field)
MoFEMErrorCode assembleGhostVector(Vec ghost_vec) const
Assemble error vector.
MoFEMErrorCode printError(Vec ghost_vec)
Print error.