v0.9.1
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, const EntFiniteElement &fe, Range &adjacency)
 
static MoFEMErrorCode defaultEdge (Interface &moab, const Field &field, const EntFiniteElement &fe, Range &adjacency)
 
static MoFEMErrorCode defaultFace (Interface &moab, const Field &field, const EntFiniteElement &fe, Range &adjacency)
 
static MoFEMErrorCode defaultTet (Interface &moab, const Field &field, const EntFiniteElement &fe, Range &adjacency)
 
static MoFEMErrorCode defaultPrism (Interface &moab, const Field &field, const EntFiniteElement &fe, Range &adjacency)
 
static MoFEMErrorCode defaultMeshset (Interface &moab, const Field &field, const EntFiniteElement &fe, Range &adjacency)
 

Detailed Description

default adjacency map

Definition at line 319 of file FEMultiIndices.hpp.

Member Function Documentation

◆ defaultEdge()

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

Definition at line 540 of file FEMultiIndices.cpp.

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

◆ defaultFace()

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

Definition at line 573 of file FEMultiIndices.cpp.

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

◆ defaultMeshset()

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

Definition at line 796 of file FEMultiIndices.cpp.

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

◆ defaultPrism()

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

Definition at line 650 of file FEMultiIndices.cpp.

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

◆ defaultTet()

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

Definition at line 612 of file FEMultiIndices.cpp.

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

◆ defaultVertex()

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

Definition at line 511 of file FEMultiIndices.cpp.

513  {
515  switch (field.getSpace()) {
516  case H1:
517  adjacency.insert(fe.getEnt());
518  break;
519  case NOFIELD: {
520  Range ents;
521  CHKERR moab.get_entities_by_handle(field.getMeshset(), ents, false);
522  adjacency.merge(ents);
523  for (Range::iterator eit = ents.begin(); eit != ents.end(); eit++) {
524  const_cast<SideNumber_multiIndex &>(fe.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.getSideNumberPtr(*eit);
536  }
538 }
scalar or vector of scalars describe (no true field)
Definition: definitions.h:175
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:482
#define CHKERR
Inline error check.
Definition: definitions.h:601
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:412
continuous field
Definition: definitions.h:176

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