Primarily this is used for testing if the code can handle user base. It is also, an example of how to build and use user approximation base. This is a test, so we used RT base by Demkowicz recipe.
Note that triple defines approximation element; element entity type, approximation space and approximation base. Entity type determines the integration method; approximation space determines the adjacency of the matrix and approximation base determines together with space the regularity of approximation.
namespace bio = boost::iostreams;
using bio::stream;
using bio::tee_device;
static char help[] =
"...\n\n";
BaseFunctionUnknownInterface **iface) const {
*iface = NULL;
} else {
}
}
boost::shared_ptr<BaseFunctionCtx> ctx_ptr) {
BaseFunctionUnknownInterface *iface;
cTx = reinterpret_cast<EntPolynomialBaseCtx *>(iface);
int nb_gauss_pts = pts.size2();
if (!nb_gauss_pts) {
}
if (pts.size1() < 3) {
"Wrong dimension of pts, should be at least 3 rows with "
"coordinates");
}
switch (cTx->sPace) {
CHKERR getValueHdivForCGGBubble(pts);
break;
default:
}
}
private:
EntPolynomialBaseCtx *cTx;
"Wrong base, should be USER_BASE");
}
DataForcesAndSourcesCore &data = cTx->dAta;
int nb_gauss_pts = pts.size2();
shapeFun.resize(nb_gauss_pts, 4, false);
&pts(1, 0), &pts(2, 0), nb_gauss_pts);
double diff_shape_fun[12];
int volume_order = data.dataOnEntities[MBTET][0].getDataOrder();
int p_f[4];
double *phi_f[4];
double *diff_phi_f[4];
for (int ff = 0; ff != 4; ff++) {
int face_order = data.dataOnEntities[MBTRI][ff].getDataOrder();
int order = volume_order > face_order ? volume_order : face_order;
data.dataOnEntities[MBTRI][ff].getN(base).resize(
data.dataOnEntities[MBTRI][ff].getDiffN(base).resize(
phi_f[ff] = &*data.dataOnEntities[MBTRI][ff].getN(base).data().begin();
diff_phi_f[ff] =
&*data.dataOnEntities[MBTRI][ff].getDiffN(base).data().begin();
continue;
&data.facesNodes(ff, 0),
order, &*shapeFun.data().begin(),
diff_shape_fun, phi_f[ff], diff_phi_f[ff], nb_gauss_pts, 4);
}
data.dataOnEntities[MBTET][0].getN(base).resize(
data.dataOnEntities[MBTET][0].getDiffN(base).resize(
double *phi_v = &*data.dataOnEntities[MBTET][0].getN(base).data().begin();
double *diff_phi_v =
&*data.dataOnEntities[MBTET][0].getDiffN(base).data().begin();
volume_order, &*shapeFun.data().begin(), diff_shape_fun, p_f, phi_f,
diff_phi_f, phi_v, diff_phi_v, nb_gauss_pts);
}
for (int ff = 0; ff != 4; ff++) {
int face_order = data.dataOnEntities[MBTRI][ff].getDataOrder();
data.dataOnEntities[MBTRI][ff].getN(base).resize(
data.dataOnEntities[MBTRI][ff].getDiffN(base).resize(
}
}
};
int main(
int argc,
char *argv[]) {
try {
PetscBool flg = PETSC_TRUE;
#if PETSC_VERSION_GE(3, 6, 4)
255, &flg);
#else
#endif
if (flg != PETSC_TRUE) {
"*** ERROR -my_file (MESH FILE NEEDED)");
}
const char *option;
option = "";
auto field_order_table =
const_cast<Field *>(field_ptr)->getFieldOrderTable();
auto get_cgg_bubble_order_zero = [](
int p) {
return 0; };
auto get_cgg_bubble_order_face = [](
int p) {
};
auto get_cgg_bubble_order_tet = [](
int p) {
};
field_order_table[MBVERTEX] = get_cgg_bubble_order_zero;
field_order_table[MBEDGE] = get_cgg_bubble_order_zero;
field_order_table[MBTRI] = get_cgg_bubble_order_face;
field_order_table[MBTET] = get_cgg_bubble_order_tet;
EntityHandle root_set = moab.get_root_set();
"FE");
true);
"PROBLEM");
"PROBLEM");
"PROBLEM");
typedef tee_device<std::ostream, std::ofstream>
TeeDevice;
std::ofstream ofs("forces_and_sources_testing_users_base.txt");
MyOp1(const std::string &row_filed, const std::string &col_field,
row_filed, col_field,
type),
my_split(_my_split) {
sYmm = false;
}
if(data.getIndices().empty()) {
}
my_split << rowFieldName << endl;
my_split <<
"side: " << side <<
" type: " <<
type << std::endl;
my_split << data << endl;
my_split << data.getN() << endl;
my_split << endl;
}
MoFEMErrorCode doWork(
int row_side,
int col_side, EntityType row_type,
EntityType col_type,
if(row_data.getIndices().empty())
if(col_data.getIndices().empty())
my_split << rowFieldName << " : " << colFieldName << endl;
my_split << "row side: " << row_side << " row_type: " << row_type
<< std::endl;
my_split << "col side: " << col_side << " col_type: " << col_type
<< std::endl;
my_split << row_data.getIndices().size() << " : "
<< col_data.getIndices().size() << endl;
my_split << endl;
}
};
fe1.getUserPolynomialBase() =
fe1.getOpPtrVector().push_back(
new MyOp1("FILED_CGG", "FILED_CGG", my_split,
fe1.getOpPtrVector().push_back(
new MyOp1("FILED_CGG", "FILED_RT", my_split,
}
return 0;
}
Implementation of H-curl base function.
#define CATCH_ERRORS
Catch errors.
FieldApproximationBase
approximation base
@ USER_BASE
user implemented approximation base
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ HDIV
field with continuous normal traction
#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.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
int main(int argc, char *argv[])
virtual MoFEMErrorCode modify_finite_element_add_field_row(const std::string &fe_name, const std::string &name_row)=0
set field row which finite element use
virtual MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
add finite element
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
virtual MoFEMErrorCode add_ents_to_finite_element_by_type(const EntityHandle entities, const EntityType type, const std::string &name, const bool recursive=true)=0
add entities to finite element
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string &name_filed)=0
set finite element field data
virtual MoFEMErrorCode modify_finite_element_add_field_col(const std::string &fe_name, const std::string &name_row)=0
set field col which finite element use
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
virtual const Field * get_field_structure(const std::string &name)=0
get field structure
virtual MoFEMErrorCode set_field_order(const EntityHandle meshset, const EntityType type, const std::string &name, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)=0
Set order approximation of the entities in the field.
virtual MoFEMErrorCode add_ents_to_field_by_type(const Range &ents, const EntityType type, const std::string &name, int verb=DEFAULT_VERBOSITY)=0
Add entities to field meshset.
VolumeElementForcesAndSourcesCoreSwitch< 0 > VolumeElementForcesAndSourcesCore
Volume finite element default.
virtual MoFEMErrorCode modify_problem_add_finite_element(const std::string &name_problem, const std::string &fe_name)=0
add finite element to problem, this add entities assigned to finite element to a particular problem
virtual MoFEMErrorCode add_problem(const std::string &name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add problem.
virtual MoFEMErrorCode modify_problem_ref_level_add_bit(const std::string &name_problem, const BitRefLevel &bit)=0
add ref level to problem
#define NBVOLUMETET_DEMKOWICZ_HDIV(P)
#define NBFACETRI_DEMKOWICZ_HDIV(P)
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
ublas::matrix< double, ublas::row_major, DoubleAllocator > MatrixDouble
implementation of Data Operators for Forces and Sources
MoFEMErrorCode Hdiv_Demkowicz_Face_MBTET_ON_FACE(int *faces_nodes, int p, double *N, double *diffN, double *phi_f, double *diff_phi_f, int gdim, int nb)
MoFEMErrorCode Hdiv_Demkowicz_Interior_MBTET(int p, double *N, double *diffN, int p_face[], double *phi_f[4], double *diff_phi_f[4], double *phi_v, double *diff_phi_v, int gdim)
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
static const MOFEMuuid IDD_TET_BASE_FUNCTION
DeprecatedCoreInterface Interface
DataForcesAndSourcesCore::EntData EntData
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, MoFEM::BaseFunctionUnknownInterface **iface) const
virtual MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)=0
build adjacencies
virtual MoFEMErrorCode add_field(const std::string &name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_of_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add field.
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.
Deprecated interface functions.
DEPRECATED MoFEMErrorCode loop_finite_elements(const Problem *problem_ptr, const std::string &fe_name, FEMethod &method, int lower_rank, int upper_rank, MoFEMTypes bh, int verb=DEFAULT_VERBOSITY)
MoFEMErrorCode getInterface(const MOFEMuuid &uuid, IFACE *&iface) const
Get interface by uuid and return reference to pointer of interface.
VolumeElementForcesAndSourcesCoreBase::UserDataOperator UserDataOperator
Class used to calculate base functions at integration points.