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 329 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 535 of file FEMultiIndices.cpp.

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

◆ defaultFace()

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

Definition at line 568 of file FEMultiIndices.cpp.

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

◆ defaultMeshset()

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

Definition at line 791 of file FEMultiIndices.cpp.

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

◆ defaultPrism()

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

Definition at line 645 of file FEMultiIndices.cpp.

648  {
650  const EntityHandle prism = fe.getEnt();
651  Range nodes;
652  // initialize side sets
653  fe.getRefElement()->getSideNumberPtr(prism);
654  EntityHandle face_side3, face_side4;
655  CHKERR moab.side_element(prism, 2, 3, face_side3);
656  CHKERR moab.side_element(prism, 2, 4, face_side4);
657  fe.getRefElement()->getSideNumberPtr(face_side3);
658  fe.getRefElement()->getSideNumberPtr(face_side4);
659  for (int qq = 0; qq < 3; qq++) {
660  EntityHandle quad = 0;
661  rval = moab.side_element(prism, 2, qq, quad);
662  if (rval != MB_SUCCESS || quad == 0)
663  continue;
664  int side_number, sense, offset;
665  rval = moab.side_number(prism, quad, side_number, sense, offset);
666  if (side_number == -1 || rval != MB_SUCCESS)
667  continue;
668  const_cast<SideNumber_multiIndex &>(fe.getSideNumberTable())
669  .insert(boost::shared_ptr<SideNumber>(
670  new SideNumber(quad, side_number, sense, offset)));
671  }
672  int ee = 0;
673  for (; ee < 3; ee++) {
674  EntityHandle edge = 0;
675  CHKERR moab.side_element(prism, 1, ee, edge);
676  boost::shared_ptr<SideNumber> side_ptr =
677  fe.getRefElement()->getSideNumberPtr(edge);
678  if (side_ptr->side_number != ee) {
679  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
680  "data inconsistency for edge %d while in FE datastructure is "
681  "numbered %d.",
682  ee, side_ptr->side_number);
683  }
684  CHKERR moab.side_element(prism, 1, 6 + ee, edge);
685  side_ptr = fe.getRefElement()->getSideNumberPtr(edge);
686  if (side_ptr->side_number != ee + 6) {
687  if (side_ptr->side_number != ee) {
688  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
689  "data inconsistency for edge %d while in FE datastructure "
690  "is numbered %d.",
691  ee, side_ptr->side_number);
692  } else {
693  side_ptr->brother_side_number = ee + 6;
694  }
695  }
696  }
697  for (; ee < 6; ee++) {
698  EntityHandle edge = 0;
699  rval = moab.side_element(prism, 1, ee, edge);
700  if (rval != MB_SUCCESS || edge == 0)
701  continue;
702  int side_number, sense, offset;
703  rval = moab.side_number(prism, edge, side_number, sense, offset);
704  if (side_number == -1 || rval != MB_SUCCESS)
705  continue;
706  const_cast<SideNumber_multiIndex &>(fe.getSideNumberTable())
707  .insert(boost::shared_ptr<SideNumber>(
708  new SideNumber(edge, side_number, sense, offset)));
709  }
710  int nn = 0;
711  for (; nn < 3; nn++) {
712  EntityHandle node;
713  CHKERR moab.side_element(prism, 0, nn, node);
714  boost::shared_ptr<SideNumber> side_ptr =
715  fe.getRefElement()->getSideNumberPtr(node);
716  if (side_ptr->side_number != nn) {
717  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
718  "data inconsistency for node %d while in FE datastructure is "
719  "numbered %d.",
720  nn, side_ptr->side_number);
721  }
722  CHKERR moab.side_element(prism, 0, nn + 3, node);
723  side_ptr = fe.getRefElement()->getSideNumberPtr(node);
724  if (side_ptr->side_number != nn + 3) {
725  if (side_ptr->side_number != nn) {
726  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
727  "data inconsistency for node %d while in FE datastructure is "
728  "numbered %d.",
729  nn, side_ptr->side_number);
730  } else {
731  side_ptr->brother_side_number = nn + 3;
732  }
733  }
734  }
735 
736  // get adjacencies
737  SideNumber_multiIndex &side_table = fe.getRefElement()->getSideNumberTable();
738  switch (field.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.getMeshset(), ents, false);
777  adjacency.merge(ents);
778  for (Range::iterator eit = ents.begin(); eit != ents.end(); eit++) {
779  const_cast<SideNumber_multiIndex &>(fe.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:179
scalar or vector of scalars describe (no true field)
Definition: definitions.h:176
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:85
field with continuous tangents
Definition: definitions.h:178
#define CHKERR
Inline error check.
Definition: definitions.h:602
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413
continuous field
Definition: definitions.h:177
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:180

◆ defaultTet()

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

Definition at line 607 of file FEMultiIndices.cpp.

610  {
612  EntityHandle fe_ent = fe.getEnt();
613  switch (field.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.getMeshset(), ents, false);
628  adjacency.merge(ents);
629  for (Range::iterator eit = ents.begin(); eit != ents.end(); eit++) {
630  const_cast<SideNumber_multiIndex &>(fe.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.getSideNumberPtr(*eit);
643 }
field with continuous normal traction
Definition: definitions.h:179
scalar or vector of scalars describe (no true field)
Definition: definitions.h:176
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
field with continuous tangents
Definition: definitions.h:178
#define CHKERR
Inline error check.
Definition: definitions.h:602
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413
continuous field
Definition: definitions.h:177
field with C-1 continuity
Definition: definitions.h:180

◆ defaultVertex()

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

Definition at line 506 of file FEMultiIndices.cpp.

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

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