static char help[] =
"testing field evaluator\n\n";
template <
typename OP>
struct MyOp :
public OP {
MyOp(std::array<double, 12> &eval_points)
:
OP(
"FIELD1", OP::OPROW),
getMatrixAdaptor(eval_points.data(), eval_points.size() / 3, 3)) {}
if (type == MBVERTEX) {
MOFEM_LOG(
"SELF", Sev::inform) <<
"FE " << OP::getFEEntityHandle();
MOFEM_LOG(
"SELF", Sev::inform) <<
"Integration pts" << std::endl;
MOFEM_LOG(
"SELF", Sev::inform) << OP::getGaussPts() << endl;
MOFEM_LOG(
"SELF", Sev::inform) <<
"Global coordinates " << endl;
MOFEM_LOG(
"SELF", Sev::inform) << OP::getCoordsAtGaussPts() << std::endl;
for (int gg = 0; gg != OP::getCoordsAtGaussPts().size1(); ++gg) {
int pt_number = OP::getGaussPts()(OP::getGaussPts().size1() - 1, gg);
MOFEM_LOG(
"SELF", Sev::inform) <<
"gg " << gg << std::endl;
MOFEM_LOG(
"SELF", Sev::inform) <<
"pt " << pt_number << std::endl;
ublas::matrix_row<MatrixDouble> coord_at_gauss_pt(
OP::getCoordsAtGaussPts(), gg);
ublas::matrix_row<MatrixShallowArrayAdaptor<double>> eval_coord(
MOFEM_LOG(
"SELF", Sev::inform) <<
"coord_at_gauss_pt ";
MOFEM_LOG(
"SELF", Sev::inform) << coord_at_gauss_pt << std::endl;
MOFEM_LOG(
"SELF", Sev::inform) <<
"eval_coord ";
MOFEM_LOG(
"SELF", Sev::inform) << eval_coord << std::endl;
double error = norm_2(coord_at_gauss_pt - eval_coord);
if (error > 1e-12)
"Difference at %d error = %3.4e", pt_number, error);
}
}
}
};
auto get_rule = [](
int order_row,
int order_col,
int order_data) {
return -1;
};
int main(
int argc,
char *argv[]) {
try {
moab::Core mb_instance;
moab::Interface &moab = mb_instance;
DMType dm_name = "DMMOFEM";
{
auto dm = simple_interface->
getDM();
if (simple_interface->
getDim() == 3) {
std::array<double, 3> point = {0, 0, 0};
const double dist = 0.1;
std::array<double, 12> eval_points = {0.0, 0.0, 0.0, 0.0, 0.01, 0.0,
-0.1, 0.0, 0.0, 0.1, 0.0, 0.0};
if (auto fe_method = data->feMethodPtr.lock()) {
fe_method->getOpPtrVector().push_back(
new MyOp<VolOp>(eval_points));
} else
"Pointer to element does not exists");
data->setEvalPoints(eval_points.data(), eval_points.size() / 3);
&point[0], dist, prb_ptr->
getName(),
}
if (simple_interface->
getDim() == 2) {
std::array<double, 3> point = {0, 0, 0};
const double dist = 0.1;
std::array<double, 12> eval_points = {
0.0, 0.0, 0.0,
0.0, 0.01, 0.0,
-0.1, 0.0, 0.0,
0.1, 0.0, 0.0};
if (auto fe_method = data->feMethodPtr.lock()) {
fe_method->getOpPtrVector().push_back(
new MyOp<FaceOp>(eval_points));
} else
"Pointer to element does not exists");
data->setEvalPoints(eval_points.data(), eval_points.size() / 3);
&point[0], dist, prb_ptr->
getName(),
}
}
}
return 0;
}
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_ATOM_TEST_INVALID
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
PetscErrorCode DMMoFEMGetProblemPtr(DM dm, const MoFEM::Problem **problem_ptr)
Get pointer to problem data structure.
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
#define MOFEM_LOG(channel, severity)
Log.
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
ublas::matrix< double, ublas::row_major, ublas::shallow_array_adaptor< double > > MatrixShallowArrayAdaptor
implementation of Data Operators for Forces and Sources
virtual int get_comm_rank() const =0
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.
Data on single entity (This is passed as argument to DataOperator::doWork)
default operator for TRI element
Field evaluator interface.
MoFEMErrorCode buildTree3D(boost::shared_ptr< SetPtsData > spd_ptr, const std::string finite_element)
Build spatial tree.
MoFEMErrorCode buildTree2D(boost::shared_ptr< SetPtsData > spd_ptr, const std::string finite_element)
Build spatial tree.
MoFEMErrorCode evalFEAtThePoint2D(const double *const point, const double distance, const std::string problem, const std::string finite_element, boost::shared_ptr< SetPtsData > data_ptr, int lower_rank, int upper_rank, boost::shared_ptr< CacheTuple > cache_ptr, MoFEMTypes bh=MF_EXIST, VERBOSITY_LEVELS verb=QUIET)
Evaluate field at artbitray position.
boost::shared_ptr< SPD > getData(const double *ptr=nullptr, const int nb_eval_points=0, const double eps=1e-12, VERBOSITY_LEVELS verb=QUIET)
Get the Data object.
MoFEMErrorCode evalFEAtThePoint3D(const double *const point, const double distance, const std::string problem, const std::string finite_element, boost::shared_ptr< SetPtsData > data_ptr, int lower_rank, int upper_rank, boost::shared_ptr< CacheTuple > cache_ptr, MoFEMTypes bh=MF_EXIST, VERBOSITY_LEVELS verb=QUIET)
Evaluate field at artbitray position.
RuleHookFun getRuleHook
Hook to get rule.
keeps basic data about problem
Simple interface for fast problem set-up.
int getDim() const
Get the problem dimension.
MoFEMErrorCode loadFile(const std::string options, const std::string mesh_file_name, LoadFileFunc loadFunc=defaultLoadFileFunc)
Load mesh file.
MoFEMErrorCode addDomainField(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_ZERO, int verb=-1)
Add field on domain.
MoFEMErrorCode getOptions()
get options
MoFEMErrorCode getDM(DM *dm)
Get DM.
MoFEMErrorCode setFieldOrder(const std::string field_name, const int order, const Range *ents=NULL)
Set field order.
MoFEMErrorCode setUp(const PetscBool is_partitioned=PETSC_TRUE)
Setup problem.
const std::string getDomainFEName() const
Get the Domain FE Name.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
Volume finite element base.
Operator used to check consistency between local coordinates and global cooridnates for integrated po...
MatrixShallowArrayAdaptor< double > evalPoints
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.