v0.15.0
Loading...
Searching...
No Matches
between_meshes_dg_projection.cpp
Go to the documentation of this file.
1/**
2 * @file between_meshes_dg_projection.cpp
3 * @example mofem/tutorials/adv-6/between_meshes_dg_projection.cpp
4 *
5 * @brief Testing Discontinuous Galerkin (DG) projection operators
6 *
7 *
8 */
9
10#include <MoFEM.hpp>
11
12using namespace MoFEM;
13
14static char help[] = "DG Projection Test - validates discontinuous Galerkin "
15 "projection accuracy\n\n";
16
17constexpr char FIELD_NAME[] = "U";
18constexpr int BASE_DIM = 1;
19constexpr int FIELD_DIM = 1;
20constexpr int SPACE_DIM = 2;
21constexpr int order = 2;
22
24using DomainEleOp = DomainEle::UserDataOperator;
26
28
29auto fun = [](const double x, const double y, const double z) {
30 return x + y + x * x + y * y;
31};
32
35
38
39struct Example {
40
41 Example(MoFEM::Interface &m_field) : mField(m_field) {}
42
44
45private:
48
53
56 MoFEMErrorCode edgeFlips(BitRefLevel parent_bit, BitRefLevel child_bit);
58
59 struct CommonData {
60 boost::shared_ptr<MatrixDouble> invJacPtr;
61 boost::shared_ptr<VectorDouble> approxVals;
62 boost::shared_ptr<MatrixDouble> approxGradVals;
63 boost::shared_ptr<MatrixDouble> approxHessianVals;
65 };
66
67 struct OpError;
68};
69
70auto save_range = [](moab::Interface &moab, const std::string name,
71 const Range r, std::vector<Tag> tags = {}) {
73 auto out_meshset = get_temp_meshset_ptr(moab);
74 CHKERR moab.add_entities(*out_meshset, r);
75 if (r.size()) {
76 CHKERR moab.write_file(name.c_str(), "VTK", "", out_meshset->get_ptr(), 1,
77 tags.data(), tags.size());
78 } else {
79 MOFEM_LOG("SELF", Sev::warning) << "Empty range for " << name;
80 }
82};
83
85 boost::shared_ptr<CommonData> commonDataPtr;
86
87 OpError(boost::shared_ptr<MatrixDouble> data_ptr)
88 : DomainEleOp(NOSPACE, OPSPACE), dataPtr(data_ptr) {}
89
90 MoFEMErrorCode doWork(int side, EntityType type, EntData &data) {
92
93 const int nb_integration_pts = getGaussPts().size2();
94
95 auto t_val = getFTensor1FromMat<1>(*(dataPtr));
96 auto t_coords = getFTensor1CoordsAtGaussPts();
97
98 for (int gg = 0; gg != nb_integration_pts; ++gg) {
99
100 double projected_value = t_val(0);
101 double analytical_value = fun(t_coords(0), t_coords(1), t_coords(2));
102 double error = projected_value - analytical_value;
103
104 constexpr double eps = 1e-8;
105 if (std::abs(error) > eps) {
106 MOFEM_LOG("SELF", Sev::error)
107 << "Projection error too large: " << error << " at point ("
108 << t_coords(0) << ", " << t_coords(1) << ")"
109 << " projected=" << projected_value
110 << " analytical=" << analytical_value;
111 SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
112 "DG projection failed accuracy test");
113 }
114
115 ++t_val;
116 ++t_coords;
117 }
118
119 MOFEM_LOG("SELF", Sev::noisy) << "DG projection accuracy validation passed";
120
122 }
123
124private:
125 boost::shared_ptr<MatrixDouble> dataPtr;
126};
127
128//! [Run programme]
135 CHKERR outputResults("out_initial.h5m");
136
137 auto parent_bit = BitRefLevel().set(0);
138 auto child_bit = BitRefLevel().set(1);
139
140 CHKERR edgeFlips(parent_bit, child_bit);
142 CHKERR projectResults(parent_bit, child_bit);
143
144 CHKERR reSetupProblem(child_bit);
145 CHKERR outputResults("out_projected.h5m");
146
148}
149//! [Run programme]
150
151//! [Read mesh]
154
156
158
159 char mesh_File_Name[255];
160 CHKERR PetscOptionsGetString(PETSC_NULLPTR, PETSC_NULLPTR, "-file_name",
161 mesh_File_Name, 255, PETSC_NULLPTR);
162 CHKERR simpleInterface->loadFile("", mesh_File_Name);
163
165}
166//! [Read mesh]
167
168//! [Set up problem]
171
174
176
177 CHKERR simpleInterface->setUp(PETSC_FALSE);
178
180}
181//! [Set up problem]
182
183//! [Push operators to pipeline]
186
187 auto rule = [](int, int, int p) -> int { return 2 * p; };
188
190
191 CHKERR pipeline_mng->setDomainLhsIntegrationRule(rule);
192 CHKERR pipeline_mng->setDomainRhsIntegrationRule(rule);
193
194 auto beta = [](const double, const double, const double) { return 1; };
195
196 pipeline_mng->getOpDomainLhsPipeline().push_back(
198
199 pipeline_mng->getOpDomainRhsPipeline().push_back(
201
203}
204//! [Push operators to pipeline]
205
206//! [Solve]
210
211 MOFEM_LOG("WORLD", Sev::inform) << "Solving DG projection system";
212
213 auto solver = pipeline_mng->createKSP();
214 CHKERR KSPSetFromOptions(solver);
215 CHKERR KSPSetUp(solver);
216
217 auto dm = simpleInterface->getDM();
218 auto D = createDMVector(dm);
219 auto F = vectorDuplicate(D);
220
221 CHKERR KSPSolve(solver, F, D);
222
223 CHKERR VecGhostUpdateBegin(D, INSERT_VALUES, SCATTER_FORWARD);
224 CHKERR VecGhostUpdateEnd(D, INSERT_VALUES, SCATTER_FORWARD);
225
226 CHKERR DMoFEMMeshToLocalVector(dm, D, INSERT_VALUES, SCATTER_REVERSE);
227
229}
230//! [Solve]
231
232//! [Project results]
234 BitRefLevel child_bit) {
237 auto pipeline_mng = mField.getInterface<PipelineManager>();
238
239 pipeline_mng->getDomainLhsFE().reset();
240 pipeline_mng->getDomainRhsFE().reset();
241 pipeline_mng->getOpDomainRhsPipeline().clear();
242
243 auto rule = [](int, int, int p) -> int { return 2 * p; };
244 CHKERR pipeline_mng->setDomainRhsIntegrationRule(rule);
245
246 // OpLoopThis, is child operator, and is use to execute
247 // fe_child_ptr, only on bit ref level and mask
248 // for child elements
249 auto get_child_op = [&](auto &pip) {
250 auto op_this_child = new OpLoopThis<DomainEle>(
251 mField, simple->getDomainFEName(), child_bit, child_bit, Sev::noisy);
252 auto fe_child_ptr = op_this_child->getThisFEPtr();
253 fe_child_ptr->getRuleHook = [] (int, int, int p) { return -1; };
254 Range child_edges;
255 CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
256 child_bit, child_bit, MBEDGE, child_edges);
257 // set integration rule, such that integration points are not on flipped edge
258 CHKERR setDGSetIntegrationPoints<SPACE_DIM>(
259 fe_child_ptr->setRuleHook, [](int, int, int p) { return 2 * p; },
260 boost::make_shared<Range>(child_edges));
261 pip.push_back(op_this_child);
262 return fe_child_ptr;
263 };
264
265 // Use field evaluator to calculate field values on parent bitref level,
266 // i.e. elements which were flipped.
267 auto get_filed_eval_op = [&](auto fe_child_ptr) {
268 auto field_eval_ptr = mField.getInterface<FieldEvaluatorInterface>();
269
270 // Get pointer of FieldEvaluator data. Note finite element and method
271 // set integrating points is destroyed when this pointer is releases
272 auto field_eval_data = field_eval_ptr->getData<DomainEle>();
273 // Build tree for particular element
274 CHKERR field_eval_ptr->buildTree<SPACE_DIM>(
275 field_eval_data, simpleInterface->getDomainFEName(), parent_bit,
276 parent_bit);
277
278 // You can add more fields here
279 auto data_ptr = boost::make_shared<MatrixDouble>();
280 auto eval_data_ptr = boost::make_shared<MatrixDouble>();
281
282 if (auto fe_eval_ptr = field_eval_data->feMethodPtr.lock()) {
283 fe_eval_ptr->getRuleHook = [] (int, int, int p) { return -1; };
284 fe_eval_ptr->getOpPtrVector().push_back(
286 eval_data_ptr));
287
288 auto op_test = new DomainEleOp(NOSPACE, DomainEleOp::OPSPACE);
289 op_test->doWorkRhsHook =
290 [](DataOperator *base_op_ptr, int side, EntityType type,
293
294 auto op_ptr = static_cast<DomainEleOp *>(base_op_ptr);
295 MOFEM_LOG_CHANNEL("SELF");
296 MOFEM_LOG("SELF", Sev::noisy)
297 << "Field evaluator method pointer is valid";
298 MOFEM_LOG("SELF", Sev::noisy)
299 << op_ptr->getGaussPts();
300 MOFEM_LOG("SELF", Sev::noisy)
301 << "Loop size " << op_ptr->getPtrFE()->getLoopSize();
302 MOFEM_LOG("SELF", Sev::noisy)
303 << "Coords at gauss pts: " << op_ptr->getCoordsAtGaussPts();
304
306 };
307
308 fe_eval_ptr->getOpPtrVector().push_back(op_test);
309
310 } else {
312 "Field evaluator method pointer is expired");
313 }
314
315 auto op_ptr = field_eval_ptr->getDataOperator<SPACE_DIM>(
316 {}, {{eval_data_ptr, data_ptr}}, simpleInterface->getDomainFEName(),
317 field_eval_data, 0, mField.get_comm_size(), parent_bit, parent_bit,
318 MF_EXIST, QUIET);
319
320 fe_child_ptr->getOpPtrVector().push_back(op_ptr);
321 return data_ptr;
322 };
323
324 // calculate coefficients on child (flipped) elements
325 auto dg_projection_base = [&](auto fe_child_ptr, auto data_ptr) {
327 constexpr int projection_order = order;
328 auto entity_data_l2 = boost::make_shared<EntitiesFieldData>(MBENTITYSET);
329 auto mass_ptr = boost::make_shared<MatrixDouble>();
330 auto coeffs_ptr = boost::make_shared<MatrixDouble>();
331
332 fe_child_ptr->getOpPtrVector().push_back(
333 new OpDGProjectionMassMatrix(projection_order, mass_ptr, entity_data_l2,
335 fe_child_ptr->getOpPtrVector().push_back(new OpDGProjectionCoefficients(
336 data_ptr, coeffs_ptr, mass_ptr, entity_data_l2, AINSWORTH_LEGENDRE_BASE,
337 L2));
338
339 // next two lines are only for testing if projection is correct, there are not
340 // essential
341 fe_child_ptr->getOpPtrVector().push_back(new OpDGProjectionEvaluation(
342 data_ptr, coeffs_ptr, entity_data_l2, AINSWORTH_LEGENDRE_BASE, L2));
343 fe_child_ptr->getOpPtrVector().push_back(new OpError(data_ptr));
344
345 // set coefficients to flipped element
346 auto op_set_coeffs = new DomainEleOp(FIELD_NAME, DomainEleOp::OPROW);
347 op_set_coeffs->doWorkRhsHook =
348 [coeffs_ptr](DataOperator *base_op_ptr, int side, EntityType type,
351 auto field_ents = data.getFieldEntities();
352 if (!field_ents.size())
354 if (auto e_ptr = field_ents[0]) {
355 auto field_ent_data = e_ptr->getEntFieldData();
356 std::copy(coeffs_ptr->data().begin(), coeffs_ptr->data().end(),
357 field_ent_data.begin());
358 }
360 };
361 fe_child_ptr->getOpPtrVector().push_back(op_set_coeffs);
362
364 };
365
366 // create child operator, and fe_child_ptr element in it
367 auto fe_child_ptr = get_child_op(pipeline_mng->getOpDomainRhsPipeline());
368 // run dg projection, note that get_filed_eval_op,
369 // pass data_ptr values used to project and calculate coefficients
370 CHKERR dg_projection_base(fe_child_ptr, get_filed_eval_op(fe_child_ptr));
371
372 // That is to test, if projection works, and coefficients are set in correctly
373 auto test_data_ptr = boost::make_shared<MatrixDouble>();
374 pipeline_mng->getOpDomainRhsPipeline().push_back(
376 pipeline_mng->getOpDomainRhsPipeline().push_back(new OpError(test_data_ptr));
377
378 CHKERR pipeline_mng->loopFiniteElements();
379
381}
382//! [Project results]
383
384//! [Output results]
387
388 auto pipeline_mng = mField.getInterface<PipelineManager>();
389 pipeline_mng->getDomainLhsFE().reset();
390
391 auto post_proc_fe = boost::make_shared<PostProcFaceEle>(mField);
393 post_proc_fe->getOpPtrVector(), {H1});
394
395 auto u_ptr = boost::make_shared<VectorDouble>();
396 auto grad_u_ptr = boost::make_shared<MatrixDouble>();
397 post_proc_fe->getOpPtrVector().push_back(
399
400 post_proc_fe->getOpPtrVector().push_back(
402
404
405 post_proc_fe->getOpPtrVector().push_back(
406
407 new OpPPMap(
408 post_proc_fe->getPostProcMesh(), post_proc_fe->getMapGaussPts(),
409
410 OpPPMap::DataMapVec{{FIELD_NAME, u_ptr}},
411
412 OpPPMap::DataMapMat{{"GRAD_" + std::string(FIELD_NAME), grad_u_ptr}},
413
415
417
418 )
419
420 );
421
422 pipeline_mng->getDomainRhsFE() = post_proc_fe;
423 CHKERR pipeline_mng->loopFiniteElements();
424 CHKERR post_proc_fe->writeFile(file_name);
425
427}
428//! [Output results]
429
430//! [Edge flips]
432 BitRefLevel child_bit) {
434
435 moab::Interface &moab = mField.get_moab();
436
437 auto make_edge_flip = [&](auto edge, auto adj_faces, Range &new_tris) {
439
440 auto get_conn = [&](EntityHandle e, EntityHandle *conn_cpy) {
442 const EntityHandle *conn;
443 int num_nodes;
444 CHKERR moab.get_connectivity(e, conn, num_nodes, true);
445 std::copy(conn, conn + num_nodes, conn_cpy);
447 };
448
449 std::array<EntityHandle, 6> adj_conn;
450 CHKERR get_conn(adj_faces[0], &adj_conn[0]);
451 CHKERR get_conn(adj_faces[1], &adj_conn[3]);
452 std::array<EntityHandle, 2> edge_conn;
453 CHKERR get_conn(edge, edge_conn.data());
454 std::array<EntityHandle, 2> new_edge_conn;
455
456 int j = 1;
457 for (int i = 0; i != 6; ++i) {
458 if (adj_conn[i] != edge_conn[0] && adj_conn[i] != edge_conn[1]) {
459 new_edge_conn[j] = adj_conn[i];
460 --j;
461 }
462 }
463
464 auto &new_conn = adj_conn; //< just alias this
465 for (int t = 0; t != 2; ++t) {
466 for (int i = 0; i != 3; ++i) {
467 if (
468
469 (adj_conn[3 * t + i % 3] == edge_conn[0] &&
470 adj_conn[3 * t + (i + 1) % 3] == edge_conn[1])
471
472 ||
473
474 (adj_conn[3 * t + i % 3] == edge_conn[1] &&
475 adj_conn[3 * t + (i + 1) % 3] == edge_conn[0])
476
477 ) {
478 new_conn[3 * t + (i + 1) % 3] = new_edge_conn[t];
479 break;
480 }
481 }
482 }
483
484 for (int t = 0; t != 2; ++t) {
485 Range rtri;
486 CHKERR moab.get_adjacencies(&new_conn[3 * t], SPACE_DIM + 1, SPACE_DIM,
487 false, rtri);
488 if (!rtri.size()) {
489 EntityHandle tri;
490 CHKERR moab.create_element(MBTRI, &new_conn[3 * t], SPACE_DIM + 1, tri);
491 new_tris.insert(tri);
492 } else {
493#ifndef NDEBUG
494 if (rtri.size() != 1) {
495 MOFEM_LOG("SELF", Sev::error)
496 << "Multiple tries created during edge flip for edge " << edge
497 << " adjacent faces " << std::endl
498 << rtri;
499 SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
500 "Multiple tries created during edge flip");
501 }
502#endif // NDEBUG
503 new_tris.merge(rtri);
504 }
505 }
506
507 Range new_edges;
508 CHKERR moab.get_adjacencies(new_tris, SPACE_DIM - 1, true, new_edges,
509 moab::Interface::UNION);
510
511#ifndef NDEBUG
512 CHKERR save_range(moab, "new_tris.vtk", new_tris);
513#endif // NDEBUG
514
516 };
517
518 Range tris;
519 CHKERR moab.get_entities_by_dimension(0, SPACE_DIM, tris);
520 CHKERR mField.getInterface<BitRefManager>()->filterEntitiesByRefLevel(
521 parent_bit, BitRefLevel().set(), tris);
522 Skinner skin(&moab);
523 Range skin_edges;
524 CHKERR skin.find_skin(0, tris, false, skin_edges);
525 Range adj_skin_tris;
526 CHKERR moab.get_adjacencies(skin_edges, SPACE_DIM, false, adj_skin_tris);
527
528 Range edges;
529 CHKERR moab.get_entities_by_dimension(0, SPACE_DIM - 1, edges);
530 CHKERR mField.getInterface<BitRefManager>()->filterEntitiesByRefLevel(
531 parent_bit, BitRefLevel().set(), edges);
532
533 Range new_tris, flipped_tris;
534 int flip_count = 0;
535 for (auto edge : edges) {
536 Range adjacent_tris;
537 CHKERR moab.get_adjacencies(&edge, 1, SPACE_DIM, false, adjacent_tris);
538 CHKERR mField.getInterface<BitRefManager>()->filterEntitiesByRefLevel(
539 parent_bit, BitRefLevel().set(), adjacent_tris);
540 adjacent_tris = subtract(adjacent_tris, adj_skin_tris);
541 adjacent_tris = subtract(adjacent_tris, flipped_tris);
542 if (adjacent_tris.size() == 2) {
543 CHKERR make_edge_flip(edge, adjacent_tris, new_tris);
544 flipped_tris.merge(adjacent_tris);
545 ++flip_count;
546 }
547 }
548
549 Range all_tris;
550 CHKERR moab.get_entities_by_dimension(0, SPACE_DIM, all_tris);
551 Range not_flipped_tris = subtract(all_tris, flipped_tris);
552
553 MOFEM_LOG("SELF", Sev::noisy)
554 << "Flipped " << flip_count << " edges with two adjacent faces.";
555 CHKERR mField.getInterface<BitRefManager>()->setBitRefLevel(not_flipped_tris,
556 child_bit);
557 CHKERR mField.getInterface<BitRefManager>()->setBitRefLevel(new_tris,
558 child_bit);
559 CHKERR mField.getInterface<BitRefManager>()->writeBitLevel(
560 child_bit, BitRefLevel().set(), "edge_flips_before_refinement.vtk", "VTK",
561 "");
562
564}
565//! [Edge flips]
566
567//! [Re-setup problem after mesh modification
574//! [Re-setup problem after mesh modification]
575
576int main(int argc, char *argv[]) {
577
578 MoFEM::Core::Initialize(&argc, &argv, NULL, help);
579
580 try {
581
582 //! [Register MoFEM discrete manager in PETSc]
583 DMType dm_name = "DMMOFEM";
584 CHKERR DMRegister_MoFEM(dm_name);
585 //! [Register MoFEM discrete manager in PETSc]
586
587 //! [Create MoAB]
588 moab::Core mb_instance;
589 moab::Interface &moab = mb_instance;
590 //! [Create MoAB]
591
592 //! [Create MoFEM]
593 MoFEM::Core core(moab);
594 MoFEM::Interface &m_field = core;
595 //! [Create MoFEM]
596
597 //! [Execute DG Projection Test]
598 Example ex(m_field);
599 CHKERR ex.runProblem();
600 //! [Execute DG Projection Test]
601 }
603
605}
void simple(double P1[], double P2[], double P3[], double c[], const int N)
Definition acoustic.cpp:69
int main()
static char help[]
constexpr char FIELD_NAME[]
constexpr int SPACE_DIM
constexpr int FIELD_DIM
constexpr int BASE_DIM
constexpr int order
ElementsAndOps< SPACE_DIM >::DomainEle DomainEle
constexpr char FIELD_NAME[]
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< 1, FIELD_DIM > OpDomainSource
constexpr int FIELD_DIM
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, FIELD_DIM > OpDomainMass
@ QUIET
#define CATCH_ERRORS
Catch errors.
@ MF_EXIST
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition definitions.h:60
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ L2
field with C-1 continuity
Definition definitions.h:88
@ NOSPACE
Definition definitions.h:83
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_ATOM_TEST_INVALID
Definition definitions.h:40
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
auto fun
constexpr int order
Order displacement.
@ F
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode)
set local (or ghosted) vector values on mesh for partition only
Definition DMMoFEM.cpp:514
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition DMMoFEM.cpp:43
auto createDMVector(DM dm)
Get smart vector from DM.
Definition DMMoFEM.hpp:1234
MoFEMErrorCode loopFiniteElements(SmartPetscObj< DM > dm=nullptr)
Iterate finite elements.
boost::ptr_deque< UserDataOperator > & getOpDomainLhsPipeline()
Get the Op Domain Lhs Pipeline object.
SmartPetscObj< KSP > createKSP(SmartPetscObj< DM > dm=nullptr)
Create KSP (linear) solver.
boost::ptr_deque< UserDataOperator > & getOpDomainRhsPipeline()
Get the Op Domain Rhs Pipeline object.
@ PETSC
Standard PETSc assembly.
#define MOFEM_LOG(channel, severity)
Log.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
FTensor::Index< 'i', SPACE_DIM > i
double D
FTensor::Index< 'j', 3 > j
constexpr double eps
Definition HenckyOps.hpp:13
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition Types.hpp:40
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
SmartPetscObj< Vec > vectorDuplicate(Vec vec)
Create duplicate vector of smart vector.
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
auto get_temp_meshset_ptr(moab::Interface &moab)
Create smart pointer to temporary meshset.
int r
Definition sdf.py:8
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
constexpr double t
plate stiffness
Definition plate.cpp:58
constexpr auto field_name
boost::shared_ptr< VectorDouble > approxVals
boost::shared_ptr< MatrixDouble > invJacPtr
boost::shared_ptr< MatrixDouble > approxGradVals
boost::shared_ptr< MatrixDouble > approxHessianVals
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
boost::shared_ptr< MatrixDouble > dataPtr
boost::shared_ptr< CommonData > commonDataPtr
OpError(boost::shared_ptr< MatrixDouble > data_ptr)
[Example]
Definition plastic.cpp:216
MoFEMErrorCode assembleSystem()
MoFEMErrorCode readMesh()
MoFEMErrorCode projectResults(BitRefLevel parent_bit, BitRefLevel child_bit)
[Solve]
MoFEMErrorCode reSetupProblem(BitRefLevel child_bit)
[Edge flips]
MoFEMErrorCode edgeFlips(BitRefLevel parent_bit, BitRefLevel child_bit)
[Output results]
MoFEMErrorCode solveSystem()
Example(MoFEM::Interface &m_field)
MoFEMErrorCode runProblem()
MoFEM::Interface & mField
Reference to MoFEM interface.
Definition plastic.cpp:226
MoFEMErrorCode setupProblem()
MoFEMErrorCode outputResults()
[Solve]
Add operators pushing bases from local to physical configuration.
Managing BitRefLevels.
virtual int get_comm_size() const =0
virtual moab::Interface & get_moab()=0
Core (interface) class.
Definition Core.hpp:82
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition Core.cpp:72
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition Core.cpp:118
base operator to do operations at Gauss Pt. level
Deprecated interface functions.
Data on single entity (This is passed as argument to DataOperator::doWork)
Field evaluator interface.
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.
Get field gradients at integration pts for scalar field rank 0, i.e. vector field.
Specialization for double precision scalar field values calculation.
Specialization for double precision vector field values calculation.
Execute "this" element in the operator.
Post post-proc data at points from hash maps.
std::map< std::string, boost::shared_ptr< MatrixDouble > > DataMapMat
std::map< std::string, boost::shared_ptr< VectorDouble > > DataMapVec
Template struct for dimension-specific finite element types.
PipelineManager interface.
boost::shared_ptr< FEMethod > & getDomainRhsFE()
Get domain right-hand side finite element.
boost::shared_ptr< FEMethod > & getDomainLhsFE()
Get domain left-hand side finite element.
MoFEMErrorCode setDomainRhsIntegrationRule(RuleHookFun rule)
Set integration rule for domain right-hand side finite element.
MoFEMErrorCode setDomainLhsIntegrationRule(RuleHookFun rule)
Set integration rule for domain left-hand side finite element.
Simple interface for fast problem set-up.
Definition Simple.hpp:27
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.
Definition Simple.cpp:261
MoFEMErrorCode loadFile(const std::string options, const std::string mesh_file_name, LoadFileFunc loadFunc=defaultLoadFileFunc)
Load mesh file.
Definition Simple.cpp:191
MoFEMErrorCode reSetUp(bool only_dm=false)
Rebuild internal MoFEM data structures.
Definition Simple.cpp:762
MoFEMErrorCode getOptions()
get options
Definition Simple.cpp:180
MoFEMErrorCode getDM(DM *dm)
Get DM.
Definition Simple.cpp:800
MoFEMErrorCode setFieldOrder(const std::string field_name, const int order, const Range *ents=NULL)
Set field order.
Definition Simple.cpp:575
MoFEMErrorCode setUp(const PetscBool is_partitioned=PETSC_TRUE)
Setup problem.
Definition Simple.cpp:736
const std::string getDomainFEName() const
Get the Domain FE Name.
Definition Simple.hpp:429
BitRefLevel & getBitRefLevel()
Get the BitRefLevel.
Definition Simple.hpp:415
intrusive_ptr for managing petsc objects
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
auto save_range
constexpr int SPACE_DIM
DomainEle::UserDataOperator DomainEleOp
PipelineManager::ElementsAndOpsByDim< SPACE_DIM >::DomainEle DomainEle