v0.9.0
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 defaultFace (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 539 of file FEMultiIndices.cpp.

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

◆ defaultFace()

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

Definition at line 571 of file FEMultiIndices.cpp.

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

◆ defaultMeshset()

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

Definition at line 790 of file FEMultiIndices.cpp.

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

◆ defaultPrism()

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

Definition at line 645 of file FEMultiIndices.cpp.

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

◆ defaultTet()

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

Definition at line 608 of file FEMultiIndices.cpp.

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

◆ defaultVertex()

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

Definition at line 511 of file FEMultiIndices.cpp.

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

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