77 {
78
80
81 try {
82
83
84 moab::Core mb_instance;
85 moab::Interface &moab = mb_instance;
86
89
90
91 DMType dm_name = "DMMOFEM";
93
94
97 {
98
99
101
103
106
108
110
111
113 auto test_point = [&]<int DIM>() {
116 auto values = boost::make_shared<MatrixDouble>();
117 auto add_ops = [&](auto &pipeline) {
121 };
124 {0., 0.01, 0.}, add_ops);
131 t_error(
i) = t_value(
i) - t_expected(
i);
133 "constant field evaluation", std::sqrt(t_error(
i) * t_error(
i)),
134 0., {1e-12, 0.});
135
136 CHKERR PetscPushErrorHandler(PetscReturnErrorHandler,
nullptr);
137 const auto missing_error =
testing->addFieldEvaluator<DIM>(
139 {1e6, 1e6, 1e6}, add_ops);
140 CHKERR PetscPopErrorHandler();
143 "Missing evaluation point did not fail the test");
144
145 CHKERR PetscPushErrorHandler(PetscReturnErrorHandler,
nullptr);
146 const auto hook_error =
testing->addFieldEvaluator<DIM>(
150 });
151 CHKERR PetscPopErrorHandler();
154 "Pipeline hook failure was not propagated");
156 };
157 if (simple_interface->
getDim() == 3)
158 CHKERR test_point.template operator()<3>();
159 else if (simple_interface->
getDim() == 2)
160 CHKERR test_point.template
operator()<2>();
161
164
165
166 auto dm = simple_interface->
getDM();
169
170 if (simple_interface->
getDim() == 3) {
171
172 std::array<double, 3> point = {0, 0, 0};
173 const double dist = 0.1;
174
175 std::array<double, 12> eval_points = {0.0, 0.0, 0.0, 0.0, 0.01, 0.0,
176 -0.1, 0.0, 0.0, 0.1, 0.0, 0.0};
177
180
181
182
184
185
186 if (auto fe_method = data->feMethodPtr) {
188 fe_method->getOpPtrVector().push_back(
new MyOp<VolOp>(eval_points));
189 } else
191 "Pointer to element does not exists");
192
193
196
197 data->setEvalPoints(eval_points.data(), eval_points.size() / 3);
198
199
201 &point[0], dist, prb_ptr->
getName(),
204 }
205
206 if (simple_interface->
getDim() == 2) {
207
208 std::array<double, 3> point = {0, 0, 0};
209 const double dist = 0.1;
210
211 std::array<double, 12> eval_points = {
212 0.0, 0.0, 0.0,
213 0.0, 0.01, 0.0,
214 -0.1, 0.0, 0.0,
215 0.1, 0.0, 0.0};
216
219
220
221
223
224
225 if (auto fe_method = data->feMethodPtr) {
227 fe_method->getOpPtrVector().push_back(
new MyOp<FaceOp>(eval_points));
228 } else
230 "Pointer to element does not exists");
231
232
235
236 data->setEvalPoints(eval_points.data(), eval_points.size() / 3);
237
238
240 &point[0], dist, prb_ptr->
getName(),
243 }
244
245 }
246 }
248
250
251 return 0;
252}
SmartPetscObj< Vec > values
#define FTENSOR_INDEX(DIM, I)
#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.
FTensor::Index< 'i', SPACE_DIM > i
DataLayoutTraits< DataLayout::GaussByCoeffs > DL
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
decltype(GetFTensor1FromMatImpl< Tensor_Dim, S, DL, M >::get(std::declval< M & >(), 0, 0)) GetFTensor1FromMatType
virtual MPI_Comm & get_comm() const =0
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.
default operator for TRI element
Field evaluator interface.
MoFEMErrorCode evalFEAtThePoint(const double *const point, const double distance, const std::string problem, const std::string finite_element, boost::shared_ptr< SetIntegrationPtsMethodData > 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 arbitrary 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 buildTree(boost::shared_ptr< SetIntegrationPtsMethodData > spd_ptr, const std::string finite_element)
Build spatial tree.
RuleHookFun getRuleHook
Hook to get rule.
Specialization for MatrixDouble vector field values calculation.
keeps basic data about problem
Simple interface for fast problem set-up.
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.
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 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 getProblemName() const
Get the Problem Name.
const std::string getDomainFEName() const
Get the Domain FE Name.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Volume finite element base.
Operator used to check consistency between local coordinates and global cooridnates for integrated po...