v0.13.0
gauss_points_on_outer_product.cpp

Testing gauss points coordinates and weights for a quad face

/** \file gauss_points_on_outer_product.cpp
\example gauss_points_on_outer_product.cpp
\brief Testing gauss points coordinates and weights for a quad face
*/
/* This file is part of MoFEM.
* MoFEM is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* MoFEM is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with MoFEM. If not, see <http://www.gnu.org/licenses/>. */
#include <MoFEM.hpp>
using namespace MoFEM;
static char help[] = "...\n\n";
int main(int argc, char *argv[]) {
MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
try {
moab::Core mb_instance;
moab::Interface &moab = mb_instance;
MoFEM::Core core(moab);
auto test_quad = [&]() {
MatrixDouble pts_quad;
int rule_ksi = 6;
int rule_eta = 8;
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);
}
double eps = 1e-8;
if (fabs(20.0 - sum_coords) > eps) {
SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"wrong result %3.4e", sum_coords);
}
if (fabs(1.0 - sum_gauss_pts) > eps) {
SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"wrong result %3.4e", sum_gauss_pts);
}
};
auto test_hex = [&]() {
MatrixDouble pts_quad;
int rule_ksi = 4;
int rule_eta = 5;
int rule_zet = 6;
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);
}
double eps = 1e-8;
if (fabs(54.0 - sum_coords) > eps) {
SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"wrong result %3.4e", sum_coords);
}
if (fabs(1.0 - sum_gauss_pts) > eps) {
SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"wrong result %3.4e", sum_gauss_pts);
}
};
CHKERR test_quad();
CHKERR test_hex();
}
}
static const double eps
#define CATCH_ERRORS
Catch errors.
Definition: definitions.h:385
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:44
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
#define CHKERR
Inline error check.
Definition: definitions.h:548
int main(int argc, char *argv[])
static char help[]
FTensor::Index< 'i', SPACE_DIM > i
UBlasMatrix< double > MatrixDouble
Definition: Types.hpp:88
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:21
CoreTmp< 0 > Core
Definition: Core.hpp:1096
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1965
Core (interface) class.
Definition: Core.hpp:92
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition: Core.cpp:85
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition: Core.cpp:125
static MoFEMErrorCode outerProductOfEdgeIntegrationPtsForQuad(MatrixDouble &pts, const int edge0, const int edge1)
Definition: Tools.cpp:551
static MoFEMErrorCode outerProductOfEdgeIntegrationPtsForHex(MatrixDouble &pts, const int edge0, const int edge1, const int edge2)
Definition: Tools.cpp:600