v0.13.1
Classes | Public Types | Public Member Functions | Public Attributes | Private Attributes | List of all members
PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT > Struct Template Reference

#include <users_modules/basic_finite_elements/src/PostProcOnRefMesh.hpp>

Inheritance diagram for PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >:
[legend]
Collaboration diagram for PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >:
[legend]

Classes

struct  OpHdivFunctions
 

Public Types

typedef PostProcTemplateOnRefineMesh< VOLUME_ELEMENT > T
 
typedef PostProcCommonOnRefMesh::CommonDataForVolume CommonData
 

Public Member Functions

 PostProcTemplateVolumeOnRefinedMesh (MoFEM::Interface &m_field, bool ten_nodes_post_proc_tets=true, int nb_ref_levels=-1)
 
int getRule (int order)
 
virtual PostProcCommonOnRefMesh::CommonDatagetCommonData ()
 
MoFEMErrorCode generateReferenceElementMesh ()
 Generate reference mesh on single element. More...
 
size_t getMaxLevel () const
 
MoFEMErrorCode setGaussPts (int order)
 Set integration points. More...
 
MoFEMErrorCode clearOperators ()
 Clear operators list. More...
 
MoFEMErrorCode preProcess ()
 
MoFEMErrorCode postProcess ()
 
MoFEMErrorCode addHdivFunctionsPostProc (const std::string field_name)
 Add operator to post-process Hdiv field. More...
 
- Public Member Functions inherited from PostProcTemplateOnRefineMesh< VOLUME_ELEMENT >
 PostProcTemplateOnRefineMesh (MoFEM::Interface &m_field)
 
virtual ~PostProcTemplateOnRefineMesh ()
 
virtual PostProcCommonOnRefMesh::CommonDatagetCommonData ()
 
MoFEMErrorCode addFieldValuesPostProc (const std::string field_name, Vec v=PETSC_NULL)
 Add operator to post-process L2, H1, Hdiv, Hcurl field value. More...
 
MoFEMErrorCode addFieldValuesPostProc (const std::string field_name, const std::string tag_name, Vec v=PETSC_NULL)
 Add operator to post-process L2 or H1 field value. More...
 
MoFEMErrorCode addFieldValuesGradientPostProc (const std::string field_name, Vec v=PETSC_NULL)
 Add operator to post-process L2 or H1 field gradient. More...
 
MoFEMErrorCode addFieldValuesGradientPostProc (const std::string field_name, const std::string tag_name, Vec v=PETSC_NULL)
 Add operator to post-process L2 or H1 field gradient. More...
 
MoFEMErrorCode addFieldValuesGradientPostProc (const std::string field_name, int space_dim, Vec v=PETSC_NULL)
 Add operator to post-process L2 or H1 field gradient. More...
 
MoFEMErrorCode writeFile (const std::string file_name)
 wrote results in (MOAB) format, use "file_name.h5m" More...
 

Public Attributes

bool tenNodesPostProcTets
 
int nbOfRefLevels
 
CommonData commonData
 
- Public Attributes inherited from PostProcTemplateOnRefineMesh< VOLUME_ELEMENT >
moab::Core coreMesh
 
moab::Interface & postProcMesh
 
boost::shared_ptr< WrapMPIComm > wrapRefMeshComm
 
std::vector< EntityHandle > mapGaussPts
 

Private Attributes

std::vector< MatrixDouble > levelShapeFunctionsTets
 
std::vector< MatrixDouble > levelGaussPtsOnRefMeshTets
 
std::vector< ublas::matrix< int > > levelRefTets
 
std::vector< MatrixDouble > levelShapeFunctionsHexes
 
std::vector< MatrixDouble > levelGaussPtsOnRefMeshHexes
 
std::vector< ublas::matrix< int > > levelRefHexes
 
EntityHandle startingVertTetHandle
 
std::vector< double * > verticesOnTetArrays
 
EntityHandle startingEleTetHandle
 
EntityHandle * tetConn
 
int countTet
 
int countVertTet
 
EntityHandle startingVertHexHandle
 
std::vector< double * > verticesOnHexArrays
 
EntityHandle startingEleHexHandle
 
EntityHandle * hexConn
 
int countHex
 
int countVertHex
 

Detailed Description

template<class VOLUME_ELEMENT>
struct PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >

Definition at line 267 of file PostProcOnRefMesh.hpp.

Member Typedef Documentation

◆ CommonData

template<class VOLUME_ELEMENT >
typedef PostProcCommonOnRefMesh::CommonDataForVolume PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::CommonData

Definition at line 285 of file PostProcOnRefMesh.hpp.

◆ T

template<class VOLUME_ELEMENT >
typedef PostProcTemplateOnRefineMesh<VOLUME_ELEMENT> PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::T

Definition at line 270 of file PostProcOnRefMesh.hpp.

Constructor & Destructor Documentation

◆ PostProcTemplateVolumeOnRefinedMesh()

template<class VOLUME_ELEMENT >
PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::PostProcTemplateVolumeOnRefinedMesh ( MoFEM::Interface m_field,
bool  ten_nodes_post_proc_tets = true,
int  nb_ref_levels = -1 
)

Member Function Documentation

◆ addHdivFunctionsPostProc()

template<class VOLUME_ELEMENT >
MoFEMErrorCode PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::addHdivFunctionsPostProc ( const std::string  field_name)

Add operator to post-process Hdiv field.

Definition at line 862 of file PostProcOnRefMesh.hpp.

862 {
864 T::getOpPtrVector().push_back(
865 new OpHdivFunctions(T::postProcMesh, T::mapGaussPts, field_name));
867 }
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
constexpr auto field_name
std::vector< EntityHandle > mapGaussPts
moab::Interface & postProcMesh

◆ clearOperators()

template<class VOLUME_ELEMENT >
MoFEMErrorCode PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::clearOperators ( )

Clear operators list.

Clear operators list, user can use the same mesh instance to post-process different problem or the same problem with different set of post-processed fields.

Definition at line 689 of file PostProcOnRefMesh.hpp.

689 {
691 T::getOpPtrVector().clear();
693 }

◆ generateReferenceElementMesh()

template<class VOLUME_ELEMENT >
MoFEMErrorCode PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::generateReferenceElementMesh ( )

Generate reference mesh on single element.

Each element is subdivided on smaller elements, i.e. a reference mesh on single element is created. Nodes of such reference mesh are used as integration points at which field values are calculated and to each node a "moab" tag is attached to store those values.

Definition at line 300 of file PostProcOnRefMesh.hpp.

300 {
302
303 auto get_nb_of_ref_levels_from_options = [this] {
304 if (nbOfRefLevels == -1) {
305 int max_level = 0;
306 PetscBool flg = PETSC_TRUE;
307 PetscOptionsGetInt(PETSC_NULL, PETSC_NULL,
308 "-my_max_post_proc_ref_level", &max_level, &flg);
309 return max_level;
310 } else {
311 return nbOfRefLevels;
312 }
313 return 0;
314 };
315
316 auto generate_for_hex = [&]() {
318
319 moab::Core core_ref;
320 moab::Interface &moab_ref = core_ref;
321
322 auto create_reference_element = [&moab_ref]() {
324 constexpr double base_coords[] = {0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0,
325 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1};
326 EntityHandle nodes[8];
327 for (int nn = 0; nn < 8; nn++)
328 CHKERR moab_ref.create_vertex(&base_coords[3 * nn], nodes[nn]);
329 EntityHandle hex;
330 CHKERR moab_ref.create_element(MBHEX, nodes, 8, hex);
332 };
333
334 auto add_ho_nodes = [&]() {
336 Range hexes;
337 CHKERR moab_ref.get_entities_by_type(0, MBHEX, hexes, true);
338 EntityHandle meshset;
339 CHKERR moab_ref.create_meshset(MESHSET_SET, meshset);
340 CHKERR moab_ref.add_entities(meshset, hexes);
341 CHKERR moab_ref.convert_entities(meshset, true, true, true);
342 CHKERR moab_ref.delete_entities(&meshset, 1);
344 };
345
346 auto set_gauss_pts = [&](std::map<EntityHandle, int> &little_map) {
348 Range hexes;
349 CHKERR moab_ref.get_entities_by_type(0, MBHEX, hexes, true);
350 Range hexes_nodes;
351 CHKERR moab_ref.get_connectivity(hexes, hexes_nodes, false);
352 auto &gauss_pts = levelGaussPtsOnRefMeshHexes[0];
353 gauss_pts.resize(hexes_nodes.size(), 4, false);
354 size_t gg = 0;
355 for (auto node : hexes_nodes) {
356 CHKERR moab_ref.get_coords(&node, 1, &gauss_pts(gg, 0));
357 little_map[node] = gg;
358 ++gg;
359 }
360 gauss_pts = trans(gauss_pts);
362 };
363
364 auto set_ref_hexes = [&](std::map<EntityHandle, int> &little_map) {
366 Range hexes;
367 CHKERR moab_ref.get_entities_by_type(0, MBHEX, hexes, true);
368 size_t hh = 0;
369 auto &ref_hexes = levelRefHexes[0];
370 for (auto hex : hexes) {
371 const EntityHandle *conn;
372 int num_nodes;
373 CHKERR moab_ref.get_connectivity(hex, conn, num_nodes, false);
374 if (ref_hexes.size2() != num_nodes) {
375 ref_hexes.resize(hexes.size(), num_nodes);
376 }
377 for (int nn = 0; nn != num_nodes; ++nn) {
378 ref_hexes(hh, nn) = little_map[conn[nn]];
379 }
380 ++hh;
381 }
383 };
384
385 auto set_shape_functions = [&]() {
387 auto &gauss_pts = levelGaussPtsOnRefMeshHexes[0];
388 auto &shape_functions = levelShapeFunctionsHexes[0];
389 const auto nb_gauss_pts = gauss_pts.size2();
390 shape_functions.resize(nb_gauss_pts, 8);
391 for (int gg = 0; gg != nb_gauss_pts; ++gg) {
392 const double ksi = gauss_pts(0, gg);
393 const double zeta = gauss_pts(1, gg);
394 const double eta = gauss_pts(2, gg);
395 shape_functions(gg, 0) = N_MBHEX0(ksi, zeta, eta);
396 shape_functions(gg, 1) = N_MBHEX1(ksi, zeta, eta);
397 shape_functions(gg, 2) = N_MBHEX2(ksi, zeta, eta);
398 shape_functions(gg, 3) = N_MBHEX3(ksi, zeta, eta);
399 shape_functions(gg, 4) = N_MBHEX4(ksi, zeta, eta);
400 shape_functions(gg, 5) = N_MBHEX5(ksi, zeta, eta);
401 shape_functions(gg, 6) = N_MBHEX6(ksi, zeta, eta);
402 shape_functions(gg, 7) = N_MBHEX7(ksi, zeta, eta);
403 }
405 };
406
407 levelRefHexes.resize(1);
409 levelShapeFunctionsHexes.resize(1);
410
411 CHKERR create_reference_element();
413 CHKERR add_ho_nodes();
414 std::map<EntityHandle, int> little_map;
415 CHKERR set_gauss_pts(little_map);
416 CHKERR set_ref_hexes(little_map);
417 CHKERR set_shape_functions();
418
420 };
421
422 auto generate_for_tet = [&]() {
424
425 const int max_level = get_nb_of_ref_levels_from_options();
426
427 moab::Core core_ref;
428 moab::Interface &moab_ref = core_ref;
429
430 auto create_reference_element = [&moab_ref]() {
432 constexpr double base_coords[] = {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1};
433 EntityHandle nodes[4];
434 for (int nn = 0; nn < 4; nn++) {
435 CHKERR
436 moab_ref.create_vertex(&base_coords[3 * nn], nodes[nn]);
437 }
438 EntityHandle tet;
439 CHKERR moab_ref.create_element(MBTET, nodes, 4, tet);
441 };
442
443 MoFEM::CoreTmp<-1> m_core_ref(moab_ref, PETSC_COMM_SELF, -2);
444 MoFEM::Interface &m_field_ref = m_core_ref;
445
446 auto refine_ref_tetrahedron = [this, &m_field_ref, max_level]() {
448 // seed ref mofem database by setting bit ref level to reference
449 // tetrahedron
450 CHKERR
451 m_field_ref.getInterface<BitRefManager>()->setBitRefLevelByDim(
452 0, 3, BitRefLevel().set(0));
453 for (int ll = 0; ll != max_level; ++ll) {
454 MOFEM_TAG_AND_LOG_C("WORLD", Sev::verbose, "PostProc",
455 "Refine Level %d", ll);
456 Range edges;
457 CHKERR m_field_ref.getInterface<BitRefManager>()
458 ->getEntitiesByTypeAndRefLevel(
459 BitRefLevel().set(ll), BitRefLevel().set(), MBEDGE, edges);
460 Range tets;
461 CHKERR m_field_ref.getInterface<BitRefManager>()
462 ->getEntitiesByTypeAndRefLevel(
463 BitRefLevel().set(ll), BitRefLevel(ll).set(), MBTET, tets);
464 // refine mesh
465 MeshRefinement *m_ref;
466 CHKERR m_field_ref.getInterface(m_ref);
467 CHKERR m_ref->addVerticesInTheMiddleOfEdges(
468 edges, BitRefLevel().set(ll + 1));
469 CHKERR m_ref->refineTets(tets, BitRefLevel().set(ll + 1));
470 }
472 };
473
474 auto get_ref_gauss_pts_and_shape_functions = [this, max_level, &moab_ref,
475 &m_field_ref]() {
477 for (int ll = 0; ll != max_level + 1; ++ll) {
478 Range tets;
479 CHKERR
480 m_field_ref.getInterface<BitRefManager>()
481 ->getEntitiesByTypeAndRefLevel(
482 BitRefLevel().set(ll), BitRefLevel().set(ll), MBTET, tets);
484 EntityHandle meshset;
485 CHKERR moab_ref.create_meshset(MESHSET_SET, meshset);
486 CHKERR moab_ref.add_entities(meshset, tets);
487 CHKERR moab_ref.convert_entities(meshset, true, false, false);
488 CHKERR moab_ref.delete_entities(&meshset, 1);
489 }
490 Range elem_nodes;
491 CHKERR moab_ref.get_connectivity(tets, elem_nodes, false);
492
493 auto &gauss_pts = levelGaussPtsOnRefMeshTets[ll];
494 gauss_pts.resize(elem_nodes.size(), 4, false);
495 std::map<EntityHandle, int> little_map;
496 Range::iterator nit = elem_nodes.begin();
497 for (int gg = 0; nit != elem_nodes.end(); nit++, gg++) {
498 CHKERR moab_ref.get_coords(&*nit, 1, &gauss_pts(gg, 0));
499 little_map[*nit] = gg;
500 }
501 gauss_pts = trans(gauss_pts);
502
503 auto &ref_tets = levelRefTets[ll];
504 Range::iterator tit = tets.begin();
505 for (int tt = 0; tit != tets.end(); ++tit, ++tt) {
506 const EntityHandle *conn;
507 int num_nodes;
508 CHKERR moab_ref.get_connectivity(*tit, conn, num_nodes, false);
509 if (tt == 0) {
510 ref_tets.resize(tets.size(), num_nodes);
511 }
512 for (int nn = 0; nn != num_nodes; ++nn) {
513 ref_tets(tt, nn) = little_map[conn[nn]];
514 }
515 }
516
517 auto &shape_functions = levelShapeFunctionsTets[ll];
518 shape_functions.resize(elem_nodes.size(), 4);
519 CHKERR ShapeMBTET(&*shape_functions.data().begin(), &gauss_pts(0, 0),
520 &gauss_pts(1, 0), &gauss_pts(2, 0),
521 elem_nodes.size());
522 }
524 };
525
526 levelRefTets.resize(max_level + 1);
527 levelGaussPtsOnRefMeshTets.resize(max_level + 1);
528 levelShapeFunctionsTets.resize(max_level + 1);
529
530 CHKERR create_reference_element();
531 CHKERR refine_ref_tetrahedron();
532 CHKERR get_ref_gauss_pts_and_shape_functions();
533
535 };
536
537 CHKERR generate_for_hex();
538 CHKERR generate_for_tet();
539
541 }
#define MOFEM_TAG_AND_LOG_C(channel, severity, tag, format,...)
Tag and log in channel.
Definition: LogManager.hpp:353
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
#define N_MBHEX7(x, y, z)
Definition: fem_tools.h:78
#define N_MBHEX3(x, y, z)
Definition: fem_tools.h:74
#define N_MBHEX5(x, y, z)
Definition: fem_tools.h:76
#define N_MBHEX4(x, y, z)
Definition: fem_tools.h:75
PetscErrorCode ShapeMBTET(double *N, const double *G_X, const double *G_Y, const double *G_Z, int DIM)
calculate shape functions
Definition: fem_tools.c:306
#define N_MBHEX0(x, y, z)
Definition: fem_tools.h:71
#define N_MBHEX6(x, y, z)
Definition: fem_tools.h:77
#define N_MBHEX2(x, y, z)
Definition: fem_tools.h:73
#define N_MBHEX1(x, y, z)
Definition: fem_tools.h:72
constexpr double eta
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:40
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
CoreTmp< 0 > Core
Definition: Core.hpp:1086
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1955
Deprecated interface functions.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
std::vector< MatrixDouble > levelGaussPtsOnRefMeshTets
std::vector< ublas::matrix< int > > levelRefTets
std::vector< MatrixDouble > levelShapeFunctionsHexes
std::vector< MatrixDouble > levelGaussPtsOnRefMeshHexes
std::vector< MatrixDouble > levelShapeFunctionsTets
std::vector< ublas::matrix< int > > levelRefHexes

◆ getCommonData()

template<class VOLUME_ELEMENT >
virtual PostProcCommonOnRefMesh::CommonData & PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::getCommonData ( )
virtual

Reimplemented from PostProcTemplateOnRefineMesh< VOLUME_ELEMENT >.

Definition at line 288 of file PostProcOnRefMesh.hpp.

288 {
289 return commonData;
290 }
CommonData commonData

◆ getMaxLevel()

template<class VOLUME_ELEMENT >
size_t PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::getMaxLevel ( ) const

Definition at line 543 of file PostProcOnRefMesh.hpp.

543 {
544 auto get_element_max_dofs_order = [&]() {
545 int max_order = 0;
546 auto dofs_vec = this->getDataVectorDofsPtr();
547 for (auto &dof : *dofs_vec) {
548 const int dof_order = dof->getDofOrder();
549 max_order = (max_order < dof_order) ? dof_order : max_order;
550 };
551 return max_order;
552 };
553 const auto dof_max_order = get_element_max_dofs_order();
554 return (dof_max_order > 0) ? (dof_max_order - 1) / 2 : 0;
555 };

◆ getRule()

template<class VOLUME_ELEMENT >
int PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::getRule ( int  order)

Definition at line 283 of file PostProcOnRefMesh.hpp.

283{ return -1; };

◆ postProcess()

template<class VOLUME_ELEMENT >
MoFEMErrorCode PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::postProcess ( )

Definition at line 796 of file PostProcOnRefMesh.hpp.

796 {
798
799 auto update_elements = [&]() {
801 ReadUtilIface *iface;
802 CHKERR this->postProcMesh.query_interface(iface);
803
804 if (countTet) {
805 MOFEM_TAG_AND_LOG("SELF", Sev::noisy, "PostProc")
806 << "Update tets " << countTet;
807
808 MOFEM_TAG_AND_LOG("SELF", Sev::noisy, "PostProc")
809 << "Nb nodes on tets " << levelRefTets[0].size2();
810
811 CHKERR iface->update_adjacencies(startingEleTetHandle, countTet,
812 levelRefTets[0].size2(), tetConn);
813 }
814 if (countHex) {
815 MOFEM_TAG_AND_LOG("SELF", Sev::noisy, "PostProc")
816 << "Update hexes " << countHex;
817 CHKERR iface->update_adjacencies(startingEleHexHandle, countHex,
818 levelRefHexes[0].size2(), hexConn);
819 }
821 };
822
823 auto resolve_shared_ents = [&]() {
825 ParallelComm *pcomm_post_proc_mesh =
826 ParallelComm::get_pcomm(&(T::postProcMesh), MYPCOMM_INDEX);
827 if (pcomm_post_proc_mesh == NULL) {
828 // T::wrapRefMeshComm =
829 // boost::make_shared<WrapMPIComm>(T::mField.get_comm(), false);
830 pcomm_post_proc_mesh = new ParallelComm(
832 PETSC_COMM_WORLD /*(T::wrapRefMeshComm)->get_comm()*/);
833 }
834
835 Range edges;
836 CHKERR T::postProcMesh.get_entities_by_type(0, MBEDGE, edges, false);
837 CHKERR T::postProcMesh.delete_entities(edges);
838 Range faces;
839 CHKERR T::postProcMesh.get_entities_by_dimension(0, 2, faces, false);
840 CHKERR T::postProcMesh.delete_entities(faces);
841
842 Range ents;
843 CHKERR T::postProcMesh.get_entities_by_dimension(0, 3, ents, false);
844
845 int rank = T::mField.get_comm_rank();
846 CHKERR T::postProcMesh.tag_clear_data(pcomm_post_proc_mesh->part_tag(),
847 ents, &rank);
848
849 CHKERR pcomm_post_proc_mesh->resolve_shared_ents(0);
850
852 };
853
854 CHKERR resolve_shared_ents();
855 CHKERR update_elements();
856
858 }
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
Definition: LogManager.hpp:345
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:215
EntityHandle startingEleHexHandle
int countHex
EntityHandle * hexConn
EntityHandle * tetConn
int countTet
EntityHandle startingEleTetHandle

◆ preProcess()

template<class VOLUME_ELEMENT >
MoFEMErrorCode PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::preProcess ( )

Definition at line 695 of file PostProcOnRefMesh.hpp.

695 {
698 ParallelComm *pcomm_post_proc_mesh =
699 ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
700 if (pcomm_post_proc_mesh != NULL)
701 delete pcomm_post_proc_mesh;
702
703 CHKERR T::postProcMesh.delete_mesh();
704
705 auto alloc_vertices_and_elements_on_post_proc_mesh = [&]() {
707
708 auto fe_ptr = this->problemPtr->numeredFiniteElementsPtr;
709
710 auto miit =
711 fe_ptr->template get<Composite_Name_And_Part_mi_tag>().lower_bound(
712 boost::make_tuple(this->getFEName(), this->getLoFERank()));
713 auto hi_miit =
714 fe_ptr->template get<Composite_Name_And_Part_mi_tag>().upper_bound(
715 boost::make_tuple(this->getFEName(), this->getHiFERank()));
716
717 const int number_of_ents_in_the_loop = this->getLoopSize();
718 if (std::distance(miit, hi_miit) != number_of_ents_in_the_loop) {
719 SETERRQ(this->mField.get_comm(), MOFEM_DATA_INCONSISTENCY,
720 "Wrong size of indicices. Inconsistent size number of iterated "
721 "elements iterated by problem and from range.");
722 }
723
724 int nb_tet_vertices = 0;
725 int nb_tets = 0;
726 int nb_hex_vertices = 0;
727 int nb_hexes = 0;
728
729 for (; miit != hi_miit; ++miit) {
730 auto type = (*miit)->getEntType();
731
732 // Set pointer to element. So that getDataVectorDofsPtr in getMaxLevel
733 // can work
734 this->numeredEntFiniteElementPtr = *miit;
735
736 bool add = true;
737 if (this->exeTestHook) {
738 add = this->exeTestHook(this);
739 }
740
741 if (add) {
742
743 auto level = getMaxLevel();
744
745 switch (type) {
746 case MBTET:
747 level = std::min(level, levelGaussPtsOnRefMeshTets.size() - 1);
748 nb_tet_vertices += levelGaussPtsOnRefMeshTets[level].size2();
749 nb_tets += levelRefTets[level].size1();
750 break;
751 case MBHEX:
752 level = std::min(level, levelGaussPtsOnRefMeshHexes.size() - 1);
753 nb_hex_vertices += levelGaussPtsOnRefMeshHexes[level].size2();
754 nb_hexes += levelRefHexes[level].size1();
755 break;
756 default:
757 SETERRQ(this->mField.get_comm(), MOFEM_DATA_INCONSISTENCY,
758 "Element type not implemented");
759 break;
760 }
761 }
762 }
763
764 ReadUtilIface *iface;
765 CHKERR this->postProcMesh.query_interface(iface);
766
767 if (nb_tets) {
768 CHKERR iface->get_node_coords(
769 3, nb_tet_vertices, 0, startingVertTetHandle, verticesOnTetArrays);
770 CHKERR iface->get_element_connect(nb_tets, levelRefTets[0].size2(),
771 MBTET, 0, startingEleTetHandle,
772 tetConn);
773 }
774
775 if (nb_hexes) {
776 CHKERR iface->get_node_coords(
777 3, nb_hex_vertices, 0, startingVertHexHandle, verticesOnHexArrays);
778 CHKERR iface->get_element_connect(nb_hexes, levelRefHexes[0].size2(),
779 MBHEX, 0, startingEleHexHandle,
780 hexConn);
781 }
782
783 countTet = 0;
784 countVertTet = 0;
785 countHex = 0;
786 countVertHex = 0;
787
789 };
790
791 CHKERR alloc_vertices_and_elements_on_post_proc_mesh();
792
794 }
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
moab::Core coreMesh
int countVertHex
size_t getMaxLevel() const
EntityHandle startingVertHexHandle
int countVertTet
std::vector< double * > verticesOnHexArrays
std::vector< double * > verticesOnTetArrays
EntityHandle startingVertTetHandle

◆ setGaussPts()

template<class VOLUME_ELEMENT >
MoFEMErrorCode PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::setGaussPts ( int  order)

Set integration points.

If reference mesh is generated on single elements. This function maps reference coordinates into physical coordinates and create element on post-processing mesh.

Definition at line 564 of file PostProcOnRefMesh.hpp.

564 {
566
567 auto type = type_from_handle(this->getFEEntityHandle());
568
569 auto set_gauss_pts = [&](auto &level_gauss_pts_on_ref_mesh, auto &level_ref,
570 auto &level_shape_functions,
571
572 auto start_vert_handle, auto start_ele_handle,
573 auto &verts_array, auto &conn, auto &ver_count,
574 auto &ele_count
575
576 ) {
578
579 auto level =
580 std::min(getMaxLevel(), level_gauss_pts_on_ref_mesh.size() - 1);
581
582 auto &level_ref_gauss_pts = level_gauss_pts_on_ref_mesh[level];
583 auto &level_ref_ele = level_ref[level];
584 auto &shape_functions = level_shape_functions[level];
585 T::gaussPts.resize(level_ref_gauss_pts.size1(),
586 level_ref_gauss_pts.size2(), false);
587 noalias(T::gaussPts) = level_ref_gauss_pts;
588
589 EntityHandle fe_ent = T::numeredEntFiniteElementPtr->getEnt();
590 {
591 const EntityHandle *conn;
592 int num_nodes;
593 T::mField.get_moab().get_connectivity(fe_ent, conn, num_nodes, true);
594 T::coords.resize(3 * num_nodes, false);
595 CHKERR T::mField.get_moab().get_coords(conn, num_nodes, &T::coords[0]);
596 }
597
598 const int num_nodes = level_ref_gauss_pts.size2();
599 T::mapGaussPts.resize(level_ref_gauss_pts.size2());
600
603 &*shape_functions.data().begin());
605 &verts_array[0][ver_count], &verts_array[1][ver_count],
606 &verts_array[2][ver_count]);
607 for (int gg = 0; gg != num_nodes; ++gg, ++ver_count) {
608
609 T::mapGaussPts[gg] = start_vert_handle + ver_count;
610
611 auto set_float_precision = [](const double x) {
612 if (std::abs(x) < std::numeric_limits<float>::epsilon())
613 return 0.;
614 else
615 return x;
616 };
617
618 t_coords(i) = 0;
619 auto t_ele_coords = getFTensor1FromArray<3, 3>(T::coords);
620 for (int nn = 0; nn != CN::VerticesPerEntity(type); ++nn) {
621 t_coords(i) += t_n * t_ele_coords(i);
622 ++t_ele_coords;
623 ++t_n;
624 }
625
626 for (auto ii : {0, 1, 2})
627 t_coords(ii) = set_float_precision(t_coords(ii));
628
629 ++t_coords;
630 }
631
632 Tag th;
633 int def_in_the_loop = -1;
634 CHKERR T::postProcMesh.tag_get_handle(
635 "NB_IN_THE_LOOP", 1, MB_TYPE_INTEGER, th,
636 MB_TAG_CREAT | MB_TAG_SPARSE, &def_in_the_loop);
637
638 commonData.tEts.clear();
639 const int num_el = level_ref_ele.size1();
640 const int num_nodes_on_ele = level_ref_ele.size2();
641 auto start_e = start_ele_handle + ele_count;
642 commonData.tEts = Range(start_e, start_e + num_el - 1);
643 for (auto tt = 0; tt != level_ref_ele.size1(); ++tt, ++ele_count) {
644 for (int nn = 0; nn != num_nodes_on_ele; ++nn) {
645 conn[num_nodes_on_ele * ele_count + nn] =
646 T::mapGaussPts[level_ref_ele(tt, nn)];
647 }
648 }
649
650 const int n_in_the_loop = T::nInTheLoop;
651 CHKERR T::postProcMesh.tag_clear_data(th, commonData.tEts,
652 &n_in_the_loop);
653
655 };
656
657 switch (type) {
658 case MBTET:
659 return set_gauss_pts(levelGaussPtsOnRefMeshTets, levelRefTets,
661
664
665 );
666 case MBHEX:
667 return set_gauss_pts(levelGaussPtsOnRefMeshHexes, levelRefHexes,
669
672
673 );
674 default:
675 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
676 "Element type not implemented");
677 }
678
680 }
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:32
FTensor::Index< 'i', SPACE_DIM > i
auto type_from_handle(const EntityHandle h)
get type from entity handle
Definition: Templates.hpp:1479
Range tEts

Member Data Documentation

◆ commonData

template<class VOLUME_ELEMENT >
CommonData PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::commonData

Definition at line 286 of file PostProcOnRefMesh.hpp.

◆ countHex

template<class VOLUME_ELEMENT >
int PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::countHex
private

Definition at line 947 of file PostProcOnRefMesh.hpp.

◆ countTet

template<class VOLUME_ELEMENT >
int PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::countTet
private

Definition at line 940 of file PostProcOnRefMesh.hpp.

◆ countVertHex

template<class VOLUME_ELEMENT >
int PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::countVertHex
private

Definition at line 948 of file PostProcOnRefMesh.hpp.

◆ countVertTet

template<class VOLUME_ELEMENT >
int PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::countVertTet
private

Definition at line 941 of file PostProcOnRefMesh.hpp.

◆ hexConn

template<class VOLUME_ELEMENT >
EntityHandle* PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::hexConn
private

Definition at line 946 of file PostProcOnRefMesh.hpp.

◆ levelGaussPtsOnRefMeshHexes

template<class VOLUME_ELEMENT >
std::vector<MatrixDouble> PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::levelGaussPtsOnRefMeshHexes
private

Definition at line 933 of file PostProcOnRefMesh.hpp.

◆ levelGaussPtsOnRefMeshTets

template<class VOLUME_ELEMENT >
std::vector<MatrixDouble> PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::levelGaussPtsOnRefMeshTets
private

Definition at line 930 of file PostProcOnRefMesh.hpp.

◆ levelRefHexes

template<class VOLUME_ELEMENT >
std::vector<ublas::matrix<int> > PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::levelRefHexes
private

Definition at line 934 of file PostProcOnRefMesh.hpp.

◆ levelRefTets

template<class VOLUME_ELEMENT >
std::vector<ublas::matrix<int> > PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::levelRefTets
private

Definition at line 931 of file PostProcOnRefMesh.hpp.

◆ levelShapeFunctionsHexes

template<class VOLUME_ELEMENT >
std::vector<MatrixDouble> PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::levelShapeFunctionsHexes
private

Definition at line 932 of file PostProcOnRefMesh.hpp.

◆ levelShapeFunctionsTets

template<class VOLUME_ELEMENT >
std::vector<MatrixDouble> PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::levelShapeFunctionsTets
private

Definition at line 929 of file PostProcOnRefMesh.hpp.

◆ nbOfRefLevels

template<class VOLUME_ELEMENT >
int PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::nbOfRefLevels

Definition at line 273 of file PostProcOnRefMesh.hpp.

◆ startingEleHexHandle

template<class VOLUME_ELEMENT >
EntityHandle PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::startingEleHexHandle
private

Definition at line 945 of file PostProcOnRefMesh.hpp.

◆ startingEleTetHandle

template<class VOLUME_ELEMENT >
EntityHandle PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::startingEleTetHandle
private

Definition at line 938 of file PostProcOnRefMesh.hpp.

◆ startingVertHexHandle

template<class VOLUME_ELEMENT >
EntityHandle PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::startingVertHexHandle
private

Definition at line 943 of file PostProcOnRefMesh.hpp.

◆ startingVertTetHandle

template<class VOLUME_ELEMENT >
EntityHandle PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::startingVertTetHandle
private

Definition at line 936 of file PostProcOnRefMesh.hpp.

◆ tenNodesPostProcTets

template<class VOLUME_ELEMENT >
bool PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::tenNodesPostProcTets

Definition at line 272 of file PostProcOnRefMesh.hpp.

◆ tetConn

template<class VOLUME_ELEMENT >
EntityHandle* PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::tetConn
private

Definition at line 939 of file PostProcOnRefMesh.hpp.

◆ verticesOnHexArrays

template<class VOLUME_ELEMENT >
std::vector<double *> PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::verticesOnHexArrays
private

Definition at line 944 of file PostProcOnRefMesh.hpp.

◆ verticesOnTetArrays

template<class VOLUME_ELEMENT >
std::vector<double *> PostProcTemplateVolumeOnRefinedMesh< VOLUME_ELEMENT >::verticesOnTetArrays
private

Definition at line 937 of file PostProcOnRefMesh.hpp.


The documentation for this struct was generated from the following file: