v0.8.23
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 532 of file FEMultiIndices.cpp.

534  {
536  EntityHandle fe_ent = fe_ptr.getEnt();
537  // Range nodes;
538  switch (field_ptr.getSpace()) {
539  case H1:
540  CHKERR moab.get_connectivity(&fe_ent, 1, adjacency, true);
541  case L2:
542  case HCURL:
543  adjacency.insert(fe_ent);
544  break;
545  case NOFIELD: {
546  Range ents;
547  CHKERR moab.get_entities_by_handle(field_ptr.getMeshset(), ents, false);
548  adjacency.merge(ents);
549  for (auto e : ents) {
550  const_cast<SideNumber_multiIndex &>(fe_ptr.getSideNumberTable())
551  .insert(boost::shared_ptr<SideNumber>(new SideNumber(e, -1, 0, 0)));
552  }
553  } break;
554  default:
555  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
556  "this field is not implemented for EDGE finite element");
557  }
558  // build side table
559  for (auto e : adjacency)
560  fe_ptr.getSideNumberPtr(e);
562 }
scalar or vector of scalars describe (no true field)
Definition: definitions.h:169
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:476
field with continuous tangents
Definition: definitions.h:171
#define CHKERR
Inline error check.
Definition: definitions.h:595
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:406
continuous field
Definition: definitions.h:170
field with C-1 continuity
Definition: definitions.h:173

◆ defaultMeshset()

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

Definition at line 783 of file FEMultiIndices.cpp.

785  {
787  EntityHandle fe_ent = fe_ptr.getEnt();
788  // get all meshsets in finite element meshset
789  Range ent_ents_meshset;
790  CHKERR moab.get_entities_by_type(fe_ent, MBENTITYSET, ent_ents_meshset,
791  false);
792  // resolve recursively all ents in the meshset
793  Range ent_ents;
794  CHKERR moab.get_entities_by_handle(fe_ent, ent_ents, true);
795  switch (field_ptr.getSpace()) {
796  case H1:
797  adjacency.merge(ent_ents.subset_by_type(MBVERTEX));
798  case HCURL:
799  adjacency.merge(ent_ents.subset_by_type(MBEDGE));
800  case HDIV:
801  adjacency.merge(ent_ents.subset_by_type(MBTRI));
802  case L2:
803  adjacency.merge(ent_ents.subset_by_type(MBTET));
804  break;
805  case NOFIELD: {
806  Range ents;
807  CHKERR moab.get_entities_by_handle(field_ptr.getMeshset(), ents, false);
808  adjacency.merge(ents);
809  for (Range::iterator eit = ents.begin(); eit != ents.end(); eit++) {
810  const_cast<SideNumber_multiIndex &>(fe_ptr.getSideNumberTable())
811  .insert(
812  boost::shared_ptr<SideNumber>(new SideNumber(*eit, -1, 0, 0)));
813  }
814  } break;
815  default:
816  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
817  }
819 }
field with continuous normal traction
Definition: definitions.h:172
scalar or vector of scalars describe (no true field)
Definition: definitions.h:169
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:476
field with continuous tangents
Definition: definitions.h:171
#define CHKERR
Inline error check.
Definition: definitions.h:595
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:406
continuous field
Definition: definitions.h:170
field with C-1 continuity
Definition: definitions.h:173

◆ defaultPrism()

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

Definition at line 638 of file FEMultiIndices.cpp.

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

◆ defaultTet()

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

Definition at line 601 of file FEMultiIndices.cpp.

603  {
605  EntityHandle fe_ent = fe_ptr.getEnt();
606  switch (field_ptr.getSpace()) {
607  case H1:
608  CHKERR moab.get_connectivity(&fe_ent, 1, adjacency, true);
609  case HCURL:
610  CHKERR moab.get_adjacencies(&fe_ent, 1, 1, false, adjacency,
611  moab::Interface::UNION);
612  case HDIV:
613  CHKERR moab.get_adjacencies(&fe_ent, 1, 2, false, adjacency,
614  moab::Interface::UNION);
615  case L2:
616  adjacency.insert(fe_ent);
617  break;
618  case NOFIELD: {
619  Range ents;
620  CHKERR moab.get_entities_by_handle(field_ptr.getMeshset(), ents, false);
621  adjacency.merge(ents);
622  for (Range::iterator eit = ents.begin(); eit != ents.end(); eit++) {
623  const_cast<SideNumber_multiIndex &>(fe_ptr.getSideNumberTable())
624  .insert(
625  boost::shared_ptr<SideNumber>(new SideNumber(*eit, -1, 0, 0)));
626  }
627  } break;
628  default:
629  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
630  "this field is not implemented for TRI finite element");
631  }
632  // build side table
633  for (Range::iterator eit = adjacency.begin(); eit != adjacency.end(); eit++)
634  fe_ptr.getSideNumberPtr(*eit);
636 }
field with continuous normal traction
Definition: definitions.h:172
scalar or vector of scalars describe (no true field)
Definition: definitions.h:169
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:476
field with continuous tangents
Definition: definitions.h:171
#define CHKERR
Inline error check.
Definition: definitions.h:595
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:406
continuous field
Definition: definitions.h:170
field with C-1 continuity
Definition: definitions.h:173

◆ defaultTri()

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

Definition at line 564 of file FEMultiIndices.cpp.

566  {
568  // Range nodes,edges;
569  const EntityHandle fe_ent = fe_ptr.getEnt();
570  switch (field_ptr.getSpace()) {
571  case H1:
572  CHKERR moab.get_connectivity(&fe_ent, 1, adjacency, true);
573  case HCURL:
574  CHKERR moab.get_adjacencies(&fe_ent, 1, 1, false, adjacency,
575  moab::Interface::UNION);
576  case HDIV:
577  adjacency.insert(fe_ent);
578  break;
579  case NOFIELD: {
580  Range ents;
581  CHKERR moab.get_entities_by_handle(field_ptr.getMeshset(), ents, false);
582  adjacency.merge(ents);
583  for (Range::iterator eit = ents.begin(); eit != ents.end(); eit++) {
584  const_cast<SideNumber_multiIndex &>(fe_ptr.getSideNumberTable())
585  .insert(
586  boost::shared_ptr<SideNumber>(new SideNumber(*eit, -1, 0, 0)));
587  }
588  } break;
589  case L2:
590  adjacency.insert(fe_ent); // add this just in case, if L2 is on skeleton
591  break;
592  default:
593  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
594  "this field is not implemented for TRI finite element");
595  }
596  // build side table
597  for (Range::iterator eit = adjacency.begin(); eit != adjacency.end(); eit++)
598  fe_ptr.getSideNumberPtr(*eit);
600 }
field with continuous normal traction
Definition: definitions.h:172
scalar or vector of scalars describe (no true field)
Definition: definitions.h:169
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:476
field with continuous tangents
Definition: definitions.h:171
#define CHKERR
Inline error check.
Definition: definitions.h:595
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:406
continuous field
Definition: definitions.h:170
field with C-1 continuity
Definition: definitions.h:173

◆ defaultVertex()

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

Definition at line 504 of file FEMultiIndices.cpp.

506  {
508  switch (field_ptr.getSpace()) {
509  case H1:
510  adjacency.insert(fe_ptr.getEnt());
511  break;
512  case NOFIELD: {
513  Range ents;
514  CHKERR moab.get_entities_by_handle(field_ptr.getMeshset(), ents, false);
515  adjacency.merge(ents);
516  for (Range::iterator eit = ents.begin(); eit != ents.end(); eit++) {
517  const_cast<SideNumber_multiIndex &>(fe_ptr.getSideNumberTable())
518  .insert(
519  boost::shared_ptr<SideNumber>(new SideNumber(*eit, -1, 0, 0)));
520  }
521  } break;
522  default:
523  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
524  "this field is not implemented for VERTEX finite element");
525  }
526  // build side table
527  for (Range::iterator eit = adjacency.begin(); eit != adjacency.end(); eit++) {
528  fe_ptr.getSideNumberPtr(*eit);
529  }
531 }
scalar or vector of scalars describe (no true field)
Definition: definitions.h:169
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:476
#define CHKERR
Inline error check.
Definition: definitions.h:595
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:406
continuous field
Definition: definitions.h:170

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