Testing gauss points coordinates and weights for a quad face.
static char help[] =
"...\n\n";
int main(
int argc,
char *argv[]) {
try {
moab::Core mb_instance;
moab::Interface &moab = mb_instance;
auto test_quad = [&]() {
int rule_ksi = 6;
int rule_eta = 8;
CHKERR Tools::outerProductOfEdgeIntegrationPtsForQuad(pts_quad, rule_ksi,
rule_eta);
int nb_gauss_pts = pts_quad.size2();
double sum_coords = 0, sum_gauss_pts = 0;
for (
int i = 0;
i < nb_gauss_pts; ++
i) {
sum_coords += pts_quad(0,
i) + pts_quad(1,
i);
sum_gauss_pts += pts_quad(2,
i);
}
if (fabs(20.0 - sum_coords) >
eps) {
"wrong result %3.4e", sum_coords);
}
if (fabs(1.0 - sum_gauss_pts) >
eps) {
"wrong result %3.4e", sum_gauss_pts);
}
};
auto test_hex = [&]() {
int rule_ksi = 4;
int rule_eta = 5;
int rule_zet = 6;
CHKERR Tools::outerProductOfEdgeIntegrationPtsForHex(pts_quad, rule_ksi,
rule_eta, rule_zet);
int nb_gauss_pts = pts_quad.size2();
double sum_coords = 0, sum_gauss_pts = 0;
for (
int i = 0;
i < nb_gauss_pts; ++
i) {
sum_coords += pts_quad(0,
i) + pts_quad(1,
i) + pts_quad(2,
i);
sum_gauss_pts += pts_quad(3,
i);
}
if (fabs(54.0 - sum_coords) >
eps) {
"wrong result %3.4e", sum_coords);
}
if (fabs(1.0 - sum_gauss_pts) >
eps) {
"wrong result %3.4e", sum_gauss_pts);
}
};
}
}
#define CATCH_ERRORS
Catch errors.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
FTensor::Index< 'i', SPACE_DIM > i
UBlasMatrix< double > MatrixDouble
implementation of Data Operators for Forces and Sources
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.