v0.8.19
Static Public Member Functions | List of all members
MoFEM::DefaultElementAdjacency Struct Reference

default adjacency map More...

#include <src/multi_indices/FEMultiIndices.hpp>

Static Public Member Functions

static MoFEMErrorCode defaultVertex (Interface &moab, const Field &field_ptr, const EntFiniteElement &fe_ptr, Range &adjacency)
 
static MoFEMErrorCode defaultEdge (Interface &moab, const Field &field_ptr, const EntFiniteElement &fe_ptr, Range &adjacency)
 
static MoFEMErrorCode defaultTri (Interface &moab, const Field &field_ptr, const EntFiniteElement &fe_ptr, Range &adjacency)
 
static MoFEMErrorCode defaultTet (Interface &moab, const Field &field_ptr, const EntFiniteElement &fe_ptr, Range &adjacency)
 
static MoFEMErrorCode defaultPrism (Interface &moab, const Field &field_ptr, const EntFiniteElement &fe_ptr, Range &adjacency)
 
static MoFEMErrorCode defaultMeshset (Interface &moab, const Field &field_ptr, const EntFiniteElement &fe_ptr, Range &adjacency)
 

Detailed Description

default adjacency map

Definition at line 320 of file FEMultiIndices.hpp.

Member Function Documentation

◆ defaultEdge()

MoFEMErrorCode MoFEM::DefaultElementAdjacency::defaultEdge ( Interface moab,
const Field field_ptr,
const EntFiniteElement fe_ptr,
Range &  adjacency 
)
static

Definition at line 548 of file FEMultiIndices.cpp.

550  {
552  EntityHandle fe_ent = fe_ptr.getEnt();
553  // Range nodes;
554  switch (field_ptr.getSpace()) {
555  case H1:
556  CHKERR moab.get_connectivity(&fe_ent, 1, adjacency, true);
557  case L2:
558  case HCURL:
559  adjacency.insert(fe_ent);
560  break;
561  case NOFIELD: {
562  Range ents;
563  CHKERR moab.get_entities_by_handle(field_ptr.getMeshset(), ents, false);
564  adjacency.merge(ents);
565  for (auto e : ents) {
566  const_cast<SideNumber_multiIndex &>(fe_ptr.getSideNumberTable())
567  .insert(boost::shared_ptr<SideNumber>(new SideNumber(e, -1, 0, 0)));
568  }
569  } break;
570  default:
571  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
572  "this field is not implemented for EDGE finite element");
573  }
574  // build side table
575  for (auto e : adjacency)
576  fe_ptr.getSideNumberPtr(e);
578 }
scalar or vector of scalars describe (no true field)
Definition: definitions.h:168
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:475
multi_index_container< boost::shared_ptr< SideNumber >, indexed_by< hashed_unique< member< SideNumber, EntityHandle, &SideNumber::ent > >, ordered_non_unique< composite_key< SideNumber, const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType >, member< SideNumber, char, &SideNumber::side_number > > >, ordered_non_unique< const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.
field with continuous tangents
Definition: definitions.h:170
#define CHKERR
Inline error check.
Definition: definitions.h:594
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:405
continuous field
Definition: definitions.h:169
field with C-1 continuity
Definition: definitions.h:172

◆ defaultMeshset()

MoFEMErrorCode MoFEM::DefaultElementAdjacency::defaultMeshset ( Interface moab,
const Field field_ptr,
const EntFiniteElement fe_ptr,
Range &  adjacency 
)
static

Definition at line 803 of file FEMultiIndices.cpp.

805  {
807  EntityHandle fe_ent = fe_ptr.getEnt();
808  // get all meshsets in finite element meshset
809  Range ent_ents_meshset;
810  CHKERR moab.get_entities_by_type(fe_ent, MBENTITYSET, ent_ents_meshset,
811  false);
812  // resolve recursively all ents in the meshset
813  Range ent_ents;
814  CHKERR moab.get_entities_by_handle(fe_ent, ent_ents, true);
815  switch (field_ptr.getSpace()) {
816  case H1:
817  adjacency.merge(ent_ents.subset_by_type(MBVERTEX));
818  case HCURL:
819  adjacency.merge(ent_ents.subset_by_type(MBEDGE));
820  case HDIV:
821  adjacency.merge(ent_ents.subset_by_type(MBTRI));
822  case L2:
823  adjacency.merge(ent_ents.subset_by_type(MBTET));
824  break;
825  case NOFIELD: {
826  Range ents;
827  CHKERR moab.get_entities_by_handle(field_ptr.getMeshset(), ents, false);
828  adjacency.merge(ents);
829  for (Range::iterator eit = ents.begin(); eit != ents.end(); eit++) {
830  const_cast<SideNumber_multiIndex &>(fe_ptr.getSideNumberTable())
831  .insert(
832  boost::shared_ptr<SideNumber>(new SideNumber(*eit, -1, 0, 0)));
833  }
834  } break;
835  default:
836  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
837  }
839 }
field with continuous normal traction
Definition: definitions.h:171
scalar or vector of scalars describe (no true field)
Definition: definitions.h:168
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:475
multi_index_container< boost::shared_ptr< SideNumber >, indexed_by< hashed_unique< member< SideNumber, EntityHandle, &SideNumber::ent > >, ordered_non_unique< composite_key< SideNumber, const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType >, member< SideNumber, char, &SideNumber::side_number > > >, ordered_non_unique< const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.
field with continuous tangents
Definition: definitions.h:170
#define CHKERR
Inline error check.
Definition: definitions.h:594
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:405
continuous field
Definition: definitions.h:169
field with C-1 continuity
Definition: definitions.h:172

◆ defaultPrism()

MoFEMErrorCode MoFEM::DefaultElementAdjacency::defaultPrism ( Interface moab,
const Field field_ptr,
const EntFiniteElement fe_ptr,
Range &  adjacency 
)
static

Definition at line 657 of file FEMultiIndices.cpp.

659  {
661  const EntityHandle prism = fe_ptr.getEnt();
662  Range nodes;
663  // initialize side sets
664  fe_ptr.getRefElement()->getSideNumberPtr(prism);
665  EntityHandle face_side3, face_side4;
666  CHKERR moab.side_element(prism, 2, 3, face_side3);
667  CHKERR moab.side_element(prism, 2, 4, face_side4);
668  fe_ptr.getRefElement()->getSideNumberPtr(face_side3);
669  fe_ptr.getRefElement()->getSideNumberPtr(face_side4);
670  for (int qq = 0; qq < 3; qq++) {
671  EntityHandle quad = 0;
672  rval = moab.side_element(prism, 2, qq, quad);
673  if (rval != MB_SUCCESS || quad == 0)
674  continue;
675  int side_number, sense, offset;
676  rval = moab.side_number(prism, quad, side_number, sense, offset);
677  if (side_number == -1 || rval != MB_SUCCESS)
678  continue;
679  const_cast<SideNumber_multiIndex &>(fe_ptr.getSideNumberTable())
680  .insert(boost::shared_ptr<SideNumber>(
681  new SideNumber(quad, side_number, sense, offset)));
682  }
683  int ee = 0;
684  for (; ee < 3; ee++) {
685  EntityHandle edge = 0;
686  CHKERR moab.side_element(prism, 1, ee, edge);
687  boost::shared_ptr<SideNumber> side_ptr =
688  fe_ptr.getRefElement()->getSideNumberPtr(edge);
689  if (side_ptr->side_number != ee) {
690  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
691  "data inconsistency for edge %d while in FE datastructure is "
692  "numbered %d.",
693  ee, side_ptr->side_number);
694  }
695  CHKERR moab.side_element(prism, 1, 6 + ee, edge);
696  side_ptr = fe_ptr.getRefElement()->getSideNumberPtr(edge);
697  if (side_ptr->side_number != ee + 6) {
698  if (side_ptr->side_number != ee) {
699  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
700  "data inconsistency for edge %d while in FE datastructure "
701  "is numbered %d.",
702  ee, side_ptr->side_number);
703  } else {
704  side_ptr->brother_side_number = ee + 6;
705  }
706  }
707  }
708  for (; ee < 6; ee++) {
709  EntityHandle edge = 0;
710  rval = moab.side_element(prism, 1, ee, edge);
711  if (rval != MB_SUCCESS || edge == 0)
712  continue;
713  int side_number, sense, offset;
714  rval = moab.side_number(prism, edge, side_number, sense, offset);
715  if (side_number == -1 || rval != MB_SUCCESS)
716  continue;
717  const_cast<SideNumber_multiIndex &>(fe_ptr.getSideNumberTable())
718  .insert(boost::shared_ptr<SideNumber>(
719  new SideNumber(edge, side_number, sense, offset)));
720  }
721  int nn = 0;
722  for (; nn < 3; nn++) {
723  EntityHandle node;
724  CHKERR moab.side_element(prism, 0, nn, node);
725  boost::shared_ptr<SideNumber> side_ptr =
726  fe_ptr.getRefElement()->getSideNumberPtr(node);
727  if (side_ptr->side_number != nn) {
728  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
729  "data inconsistency for node %d while in FE datastructure is "
730  "numbered %d.",
731  nn, side_ptr->side_number);
732  }
733  CHKERR moab.side_element(prism, 0, nn + 3, node);
734  side_ptr = fe_ptr.getRefElement()->getSideNumberPtr(node);
735  if (side_ptr->side_number != nn + 3) {
736  if (side_ptr->side_number != nn) {
737  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
738  "data inconsistency for node %d while in FE datastructure is "
739  "numbered %d.",
740  nn, side_ptr->side_number);
741  } else {
742  side_ptr->brother_side_number = nn + 3;
743  }
744  }
745  }
746 
747  // get adjacencies
748  SideNumber_multiIndex &side_table =
749  fe_ptr.getRefElement()->getSideNumberTable();
750  switch (field_ptr.getSpace()) {
751  case H1:
752  // moab.get_connectivity(&prism,1,nodes,true);
753  // use get adjacencies, this will allow take in account adjacencies set user
754  CHKERR moab.get_adjacencies(&prism, 1, 0, false, nodes,
755  moab::Interface::UNION);
756  {
757  Range topo_nodes;
758  CHKERR moab.get_connectivity(&prism, 1, topo_nodes, true);
759  Range mid_nodes;
760  CHKERR moab.get_connectivity(&prism, 1, mid_nodes, false);
761  mid_nodes = subtract(mid_nodes, topo_nodes);
762  nodes = subtract(nodes, mid_nodes);
763  }
764  adjacency.insert(nodes.begin(), nodes.end());
765  case HCURL: {
766  SideNumber_multiIndex::nth_index<2>::type::iterator siit, hi_siit;
767  siit = side_table.get<2>().lower_bound(MBEDGE);
768  hi_siit = side_table.get<2>().upper_bound(MBEDGE);
769  for (; siit != hi_siit; siit++)
770  adjacency.insert(siit->get()->ent);
771  }
772  case HDIV: {
773  SideNumber_multiIndex::nth_index<2>::type::iterator siit, hi_siit;
774  siit = side_table.get<2>().lower_bound(MBTRI);
775  hi_siit = side_table.get<2>().upper_bound(MBTRI);
776  for (; siit != hi_siit; siit++)
777  adjacency.insert(siit->get()->ent);
778  siit = side_table.get<2>().lower_bound(MBQUAD);
779  hi_siit = side_table.get<2>().upper_bound(MBQUAD);
780  for (; siit != hi_siit; siit++)
781  adjacency.insert(siit->get()->ent);
782  }
783  case L2:
784  adjacency.insert(prism);
785  break;
786  case NOFIELD: {
787  Range ents;
788  CHKERR moab.get_entities_by_handle(field_ptr.getMeshset(), ents, false);
789  adjacency.merge(ents);
790  for (Range::iterator eit = ents.begin(); eit != ents.end(); eit++) {
791  const_cast<SideNumber_multiIndex &>(fe_ptr.getSideNumberTable())
792  .insert(
793  boost::shared_ptr<SideNumber>(new SideNumber(*eit, -1, 0, 0)));
794  }
795  } break;
796  default:
797  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
798  "this field is not implemented for TRI finite element");
799  }
801 }
field with continuous normal traction
Definition: definitions.h:171
scalar or vector of scalars describe (no true field)
Definition: definitions.h:168
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:475
multi_index_container< boost::shared_ptr< SideNumber >, indexed_by< hashed_unique< member< SideNumber, EntityHandle, &SideNumber::ent > >, ordered_non_unique< composite_key< SideNumber, const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType >, member< SideNumber, char, &SideNumber::side_number > > >, ordered_non_unique< const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
field with continuous tangents
Definition: definitions.h:170
#define CHKERR
Inline error check.
Definition: definitions.h:594
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:405
continuous field
Definition: definitions.h:169
field with C-1 continuity
Definition: definitions.h:172

◆ defaultTet()

MoFEMErrorCode MoFEM::DefaultElementAdjacency::defaultTet ( Interface moab,
const Field field_ptr,
const EntFiniteElement fe_ptr,
Range &  adjacency 
)
static

Definition at line 619 of file FEMultiIndices.cpp.

621  {
623  EntityHandle fe_ent = fe_ptr.getEnt();
624  switch (field_ptr.getSpace()) {
625  case H1:
626  CHKERR moab.get_connectivity(&fe_ent, 1, adjacency, true);
627  case HCURL:
628  CHKERR moab.get_adjacencies(&fe_ent, 1, 1, false, adjacency,
629  moab::Interface::UNION);
630  case HDIV:
631  CHKERR moab.get_adjacencies(&fe_ent, 1, 2, false, adjacency,
632  moab::Interface::UNION);
633  case L2:
634  adjacency.insert(fe_ent);
635  break;
636  case NOFIELD: {
637  Range ents;
638  CHKERR moab.get_entities_by_handle(field_ptr.getMeshset(), ents, false);
639  adjacency.merge(ents);
640  for (Range::iterator eit = ents.begin(); eit != ents.end(); eit++) {
641  const_cast<SideNumber_multiIndex &>(fe_ptr.getSideNumberTable())
642  .insert(
643  boost::shared_ptr<SideNumber>(new SideNumber(*eit, -1, 0, 0)));
644  }
645  } break;
646  default:
647  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
648  "this field is not implemented for TRI finite element");
649  }
650  // build side table
651  for (Range::iterator eit = adjacency.begin(); eit != adjacency.end(); eit++)
652  fe_ptr.getSideNumberPtr(*eit);
654 }
field with continuous normal traction
Definition: definitions.h:171
scalar or vector of scalars describe (no true field)
Definition: definitions.h:168
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:475
multi_index_container< boost::shared_ptr< SideNumber >, indexed_by< hashed_unique< member< SideNumber, EntityHandle, &SideNumber::ent > >, ordered_non_unique< composite_key< SideNumber, const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType >, member< SideNumber, char, &SideNumber::side_number > > >, ordered_non_unique< const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.
field with continuous tangents
Definition: definitions.h:170
#define CHKERR
Inline error check.
Definition: definitions.h:594
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:405
continuous field
Definition: definitions.h:169
field with C-1 continuity
Definition: definitions.h:172

◆ defaultTri()

MoFEMErrorCode MoFEM::DefaultElementAdjacency::defaultTri ( Interface moab,
const Field field_ptr,
const EntFiniteElement fe_ptr,
Range &  adjacency 
)
static

Definition at line 581 of file FEMultiIndices.cpp.

583  {
585  // Range nodes,edges;
586  const EntityHandle fe_ent = fe_ptr.getEnt();
587  switch (field_ptr.getSpace()) {
588  case H1:
589  CHKERR moab.get_connectivity(&fe_ent, 1, adjacency, true);
590  case HCURL:
591  CHKERR moab.get_adjacencies(&fe_ent, 1, 1, false, adjacency,
592  moab::Interface::UNION);
593  case HDIV:
594  adjacency.insert(fe_ent);
595  break;
596  case NOFIELD: {
597  Range ents;
598  CHKERR moab.get_entities_by_handle(field_ptr.getMeshset(), ents, false);
599  adjacency.merge(ents);
600  for (Range::iterator eit = ents.begin(); eit != ents.end(); eit++) {
601  const_cast<SideNumber_multiIndex &>(fe_ptr.getSideNumberTable())
602  .insert(
603  boost::shared_ptr<SideNumber>(new SideNumber(*eit, -1, 0, 0)));
604  }
605  } break;
606  case L2:
607  adjacency.insert(fe_ent); // add this just in case, if L2 is on skeleton
608  break;
609  default:
610  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
611  "this field is not implemented for TRI finite element");
612  }
613  // build side table
614  for (Range::iterator eit = adjacency.begin(); eit != adjacency.end(); eit++)
615  fe_ptr.getSideNumberPtr(*eit);
617 }
field with continuous normal traction
Definition: definitions.h:171
scalar or vector of scalars describe (no true field)
Definition: definitions.h:168
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:475
multi_index_container< boost::shared_ptr< SideNumber >, indexed_by< hashed_unique< member< SideNumber, EntityHandle, &SideNumber::ent > >, ordered_non_unique< composite_key< SideNumber, const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType >, member< SideNumber, char, &SideNumber::side_number > > >, ordered_non_unique< const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.
field with continuous tangents
Definition: definitions.h:170
#define CHKERR
Inline error check.
Definition: definitions.h:594
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:405
continuous field
Definition: definitions.h:169
field with C-1 continuity
Definition: definitions.h:172

◆ defaultVertex()

MoFEMErrorCode MoFEM::DefaultElementAdjacency::defaultVertex ( Interface moab,
const Field field_ptr,
const EntFiniteElement fe_ptr,
Range &  adjacency 
)
static

Definition at line 519 of file FEMultiIndices.cpp.

521  {
523  switch (field_ptr.getSpace()) {
524  case H1:
525  adjacency.insert(fe_ptr.getEnt());
526  break;
527  case NOFIELD: {
528  Range ents;
529  CHKERR moab.get_entities_by_handle(field_ptr.getMeshset(), ents, false);
530  adjacency.merge(ents);
531  for (Range::iterator eit = ents.begin(); eit != ents.end(); eit++) {
532  const_cast<SideNumber_multiIndex &>(fe_ptr.getSideNumberTable())
533  .insert(
534  boost::shared_ptr<SideNumber>(new SideNumber(*eit, -1, 0, 0)));
535  }
536  } break;
537  default:
538  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
539  "this field is not implemented for VERTEX finite element");
540  }
541  // build side table
542  for (Range::iterator eit = adjacency.begin(); eit != adjacency.end(); eit++) {
543  fe_ptr.getSideNumberPtr(*eit);
544  }
546 }
scalar or vector of scalars describe (no true field)
Definition: definitions.h:168
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:475
multi_index_container< boost::shared_ptr< SideNumber >, indexed_by< hashed_unique< member< SideNumber, EntityHandle, &SideNumber::ent > >, ordered_non_unique< composite_key< SideNumber, const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType >, member< SideNumber, char, &SideNumber::side_number > > >, ordered_non_unique< const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.
#define CHKERR
Inline error check.
Definition: definitions.h:594
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:405
continuous field
Definition: definitions.h:169

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