v0.11.0
Classes | Public Types | Public Member Functions | Public Attributes | Private Attributes | Friends | List of all members
MoFEM::Problem Struct Reference

keeps basic data about problem More...

#include <src/multi_indices/ProblemsMultiIndices.hpp>

Classes

struct  SubProblemData
 Subproblem problem data. More...
 

Public Types

typedef multi_index_container< boost::weak_ptr< std::vector< NumeredDofEntity > >, indexed_by< sequenced<> > > SequenceDofContainer
 

Public Member Functions

boost::shared_ptr< NumeredDofEntity_multiIndex > & getNumeredRowDofsPtr () const
 get access to numeredRowDofsPtr storing DOFs on rows More...
 
boost::shared_ptr< NumeredDofEntity_multiIndex > & getNumeredColDofsPtr () const
 get access to numeredColDofsPtr storing DOFs on cols More...
 
const boost::shared_ptr< NumeredEntFiniteElement_multiIndex > & getNumeredFiniteElementsPtr () const
 get access to reference for multi-index storing finite elements More...
 
DEPRECATED boost::shared_ptr< NumeredDofEntity_multiIndex > & getNumeredRowDofs () const
 get access to numeredRowDofsPtr storing DOFs on rows \deprected Use getNumeredRowDofsPtr More...
 
DEPRECATED boost::shared_ptr< NumeredDofEntity_multiIndex > & getNumeredColDofs () const
 get access to numeredColDofsPtr storing DOFs on cols More...
 
const boost::shared_ptr< NumeredEntFiniteElement_multiIndex > &DEPRECATED getNumeredFiniteElements () const
 get access to reference for multi-index storing finite elements More...
 
boost::shared_ptr< SubProblemData > & getSubData () const
 Get main problem of sub-problem is. More...
 
boost::shared_ptr< ComposedProblemsData > & getComposedProblemsData () const
 Het composed problems data structure. More...
 
MoFEMErrorCode getDofByNameEntAndEntDofIdx (const int field_bit_number, const EntityHandle ent, const int ent_dof_idx, const RowColData row_or_col, boost::shared_ptr< NumeredDofEntity > &dof_ptr) const
 get DOFs from problem More...
 
NumeredEntFiniteElementbyName::iterator getNumeredFEsBegin (std::string fe_name) const
 
NumeredEntFiniteElementbyName::iterator getNumeredFEsEnd (std::string fe_name) const
 
NumeredDofEntity_multiIndex::iterator getNumeredRowDofsBegin () const
 
NumeredDofEntity_multiIndex::iterator getNumeredRowDofsEnd () const
 
NumeredDofEntity_multiIndex::iterator getNumeredColDofsBegin () const
 
NumeredDofEntity_multiIndex::iterator getNumeredColDofsEnd () const
 
NumeredDofEntityByLocalIdx::iterator getNumeredRowDofsByLocIdxBegin (const DofIdx locidx) const
 
NumeredDofEntityByLocalIdx::iterator getNumeredRowDofsByLocIdxEnd (const DofIdx locidx) const
 
NumeredDofEntityByLocalIdx::iterator getNumeredColDofsByLocIdxBegin (const DofIdx locidx) const
 
NumeredDofEntityByLocalIdx::iterator getNumeredColDofsByLocIdxEnd (const DofIdx locidx) const
 
NumeredDofEntityByEnt::iterator getNumeredRowDofsByEntBegin (const EntityHandle ent) const
 
NumeredDofEntityByEnt::iterator getNumeredRowDofsByEntEnd (const EntityHandle ent) const
 
NumeredDofEntityByEnt::iterator getNumeredColDofsByEntBegin (const EntityHandle ent) const
 
NumeredDofEntityByEnt::iterator getNumeredColDofsByEntEnd (const EntityHandle ent) const
 
 Problem (Interface &moab, const EntityHandle meshset)
 
virtual ~Problem ()=default
 
BitProblemId getId () const
 
std::string getName () const
 
DofIdx getNbDofsRow () const
 
DofIdx getNbDofsCol () const
 
DofIdx getNbLocalDofsRow () const
 
DofIdx getNbLocalDofsCol () const
 
DofIdx getNbGhostDofsRow () const
 
DofIdx getNbGhostDofsCol () const
 
BitRefLevel getBitRefLevel () const
 
BitRefLevel getMaskBitRefLevel () const
 
MoFEMErrorCode getRowDofsByPetscGlobalDofIdx (DofIdx idx, const NumeredDofEntity **dof_ptr, MoFEMTypes bh=MF_EXIST) const
 Get the Row Dofs By Petsc Global Dof Idx object. More...
 
MoFEMErrorCode getColDofsByPetscGlobalDofIdx (DofIdx idx, const NumeredDofEntity **dof_ptr, MoFEMTypes bh=MF_EXIST) const
 Get the Col Dofs By Petsc Global Dof Idx object. More...
 
boost::weak_ptr< NumeredDofEntitygetRowDofsByPetscGlobalDofIdx (DofIdx idx) const
 Get the Row Dofs By Petsc Global Dof Idx object. More...
 
boost::weak_ptr< NumeredDofEntitygetColDofsByPetscGlobalDofIdx (DofIdx idx) const
 Get the Col Dofs By Petsc Global Dof Idx object. More...
 
BitFEId getBitFEId () const
 
MoFEMErrorCode getNumberOfElementsByNameAndPart (MPI_Comm comm, const std::string name, PetscLayout *layout) const
 Get number of finite elements by name on processors. More...
 
MoFEMErrorCode getNumberOfElementsByPart (MPI_Comm comm, PetscLayout *layout) const
 Get number of finite elements on processors. More...
 
boost::shared_ptr< SequenceDofContainer > & getRowDofsSequence () const
 Get reference to sequence data numbered dof container. More...
 
boost::shared_ptr< SequenceDofContainer > & getColDofsSequence () const
 Get reference to sequence data numbered dof container. More...
 

Public Attributes

EntityHandle meshset
 
BitProblemIdtagId
 Unique problem ID. More...
 
const char * tagName
 Problem name. More...
 
int tagNameSize
 Size of problem name. More...
 
BitFEIdtagBitFEId
 IDs of finite elements in problem. More...
 
BitRefLeveltagBitRefLevel
 BitRef level of finite elements in problem. More...
 
BitRefLeveltagMaskBitRefLevel
 BItRefMask of elements in problem. More...
 
DofIdx nbDofsRow
 Global number of DOFs in row. More...
 
DofIdx nbDofsCol
 Global number of DOFs in col. More...
 
DofIdx nbLocDofsRow
 Local number of DOFs in row. More...
 
DofIdx nbLocDofsCol
 Local number of DOFs in colIs. More...
 
DofIdx nbGhostDofsRow
 Number of ghost DOFs in row. More...
 
DofIdx nbGhostDofsCol
 Number of ghost DOFs in col. More...
 
boost::shared_ptr< NumeredDofEntity_multiIndexnumeredRowDofsPtr
 store DOFs on rows for this problem More...
 
boost::shared_ptr< NumeredDofEntity_multiIndexnumeredColDofsPtr
 store DOFs on columns for this problem More...
 
boost::shared_ptr< NumeredEntFiniteElement_multiIndexnumeredFiniteElementsPtr
 store finite elements More...
 
boost::shared_ptr< SubProblemDatasubProblemData
 
boost::shared_ptr< ComposedProblemsDatacomposedProblemsData
 

Private Attributes

boost::shared_ptr< SequenceDofContainersequenceRowDofContainer
 
boost::shared_ptr< SequenceDofContainersequenceColDofContainer
 

Friends

std::ostream & operator<< (std::ostream &os, const Problem &e)
 

Detailed Description

keeps basic data about problem

This is low level structure with information about problem, what elements compose problem and what DOFs are on rows and columns.

Todo:
fix names following name convention
Examples
EshelbianPlasticity.cpp, MagneticElement.hpp, Remodeling.cpp, field_evaluator.cpp, loop_entities.cpp, lorentz_force.cpp, and test_cache_on_entities.cpp.

Definition at line 79 of file ProblemsMultiIndices.hpp.

Member Typedef Documentation

◆ SequenceDofContainer

typedef multi_index_container<boost::weak_ptr<std::vector<NumeredDofEntity> >, indexed_by<sequenced<> > > MoFEM::Problem::SequenceDofContainer

Definition at line 641 of file ProblemsMultiIndices.hpp.

Constructor & Destructor Documentation

◆ Problem()

MoFEM::Problem::Problem ( Interface moab,
const EntityHandle  meshset 
)

Definition at line 22 of file ProblemsMultiIndices.cpp.

28  ErrorCode rval;
29  Tag th_ProblemId;
30  rval = moab.tag_get_handle("_ProblemId", th_ProblemId);
32  rval = moab.tag_get_by_ptr(th_ProblemId, &meshset, 1, (const void **)&tagId);
34  Tag th_ProblemName;
35  rval = moab.tag_get_handle("_ProblemName", th_ProblemName);
37  rval = moab.tag_get_by_ptr(th_ProblemName, &meshset, 1,
38  (const void **)&tagName, &tagNameSize);
40  Tag th_ProblemFEId;
41  rval = moab.tag_get_handle("_ProblemFEId", th_ProblemFEId);
43  rval = moab.tag_get_by_ptr(th_ProblemFEId, &meshset, 1,
44  (const void **)&tagBitFEId);
46  Tag th_RefBitLevel;
47  rval = moab.tag_get_handle("_RefBitLevel", th_RefBitLevel);
49  rval = moab.tag_get_by_ptr(th_RefBitLevel, &meshset, 1,
50  (const void **)&tagBitRefLevel);
52  Tag th_RefBitLevel_Mask;
53  rval = moab.tag_get_handle("_RefBitLevelMask", th_RefBitLevel_Mask);
55  rval = moab.tag_get_by_ptr(th_RefBitLevel_Mask, &meshset, 1,
56  (const void **)&tagMaskBitRefLevel);
58 }
#define MOAB_THROW(a)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:610
multi_index_container< boost::shared_ptr< NumeredDofEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, UId, &NumeredDofEntity::getLocalUniqueId > >, ordered_non_unique< tag< Part_mi_tag >, member< NumeredDofEntity, unsigned int, &NumeredDofEntity::pArt > >, ordered_non_unique< tag< Idx_mi_tag >, member< NumeredDofEntity, DofIdx, &NumeredDofEntity::dofIdx > >, ordered_non_unique< tag< PetscGlobalIdx_mi_tag >, member< NumeredDofEntity, DofIdx, &NumeredDofEntity::petscGloablDofIdx > >, ordered_non_unique< tag< PetscLocalIdx_mi_tag >, member< NumeredDofEntity, DofIdx, &NumeredDofEntity::petscLocalDofIdx > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, EntityHandle, &NumeredDofEntity::getEnt > > > > NumeredDofEntity_multiIndex
MultiIndex container keeps NumeredDofEntity.
multi_index_container< boost::shared_ptr< NumeredEntFiniteElement >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< NumeredEntFiniteElement::interface_type_EntFiniteElement, UId, &NumeredEntFiniteElement::getLocalUniqueId > >, ordered_non_unique< tag< Part_mi_tag >, member< NumeredEntFiniteElement, unsigned int, &NumeredEntFiniteElement::part > >, ordered_non_unique< tag< FiniteElement_name_mi_tag >, const_mem_fun< NumeredEntFiniteElement::interface_type_FiniteElement, boost::string_ref, &NumeredEntFiniteElement::getNameRef > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< NumeredEntFiniteElement::interface_type_RefEntity, EntityHandle, &NumeredEntFiniteElement::getEnt > >, ordered_non_unique< tag< Composite_Name_And_Ent_mi_tag >, composite_key< NumeredEntFiniteElement, const_mem_fun< NumeredEntFiniteElement::interface_type_FiniteElement, boost::string_ref, &NumeredEntFiniteElement::getNameRef >, const_mem_fun< NumeredEntFiniteElement::interface_type_RefEntity, EntityHandle, &NumeredEntFiniteElement::getEnt > > >, ordered_non_unique< tag< Composite_Name_And_Part_mi_tag >, composite_key< NumeredEntFiniteElement, const_mem_fun< NumeredEntFiniteElement::interface_type_FiniteElement, boost::string_ref, &NumeredEntFiniteElement::getNameRef >, member< NumeredEntFiniteElement, unsigned int, &NumeredEntFiniteElement::part > > > > > NumeredEntFiniteElement_multiIndex
MultiIndex for entities for NumeredEntFiniteElement.
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:85
const char * tagName
Problem name.
boost::shared_ptr< SequenceDofContainer > sequenceColDofContainer
BitProblemId * tagId
Unique problem ID.
BitRefLevel * tagMaskBitRefLevel
BItRefMask of elements in problem.
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredRowDofsPtr
store DOFs on rows for this problem
boost::shared_ptr< NumeredEntFiniteElement_multiIndex > numeredFiniteElementsPtr
store finite elements
boost::shared_ptr< SequenceDofContainer > sequenceRowDofContainer
int tagNameSize
Size of problem name.
BitFEId * tagBitFEId
IDs of finite elements in problem.
multi_index_container< boost::weak_ptr< std::vector< NumeredDofEntity > >, indexed_by< sequenced<> > > SequenceDofContainer
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredColDofsPtr
store DOFs on columns for this problem
BitRefLevel * tagBitRefLevel
BitRef level of finite elements in problem.

◆ ~Problem()

virtual MoFEM::Problem::~Problem ( )
virtualdefault

Member Function Documentation

◆ getBitFEId()

BitFEId MoFEM::Problem::getBitFEId ( ) const

Definition at line 66 of file ProblemsMultiIndices.cpp.

66 { return *tagBitFEId; }

◆ getBitRefLevel()

BitRefLevel MoFEM::Problem::getBitRefLevel ( ) const

Definition at line 538 of file ProblemsMultiIndices.hpp.

538 { return *tagBitRefLevel; }

◆ getColDofsByPetscGlobalDofIdx() [1/2]

boost::weak_ptr< NumeredDofEntity > MoFEM::Problem::getColDofsByPetscGlobalDofIdx ( DofIdx  idx) const

Get the Col Dofs By Petsc Global Dof Idx object.

Parameters
idx
Returns
boost::weak_ptr<NumeredDofEntity>

Definition at line 80 of file ProblemsMultiIndices.cpp.

80  {
82  boost::weak_ptr<NumeredDofEntity> dof_weak_ptr;
83  NumeredDofEntity_multiIndex::index<PetscGlobalIdx_mi_tag>::type::iterator dit;
84  dit = numeredColDofsPtr->get<PetscGlobalIdx_mi_tag>().find(idx);
85  if (dit != numeredColDofsPtr->get<PetscGlobalIdx_mi_tag>().end())
86  dof_weak_ptr = *dit;
87  return dof_weak_ptr;
88 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:509

◆ getColDofsByPetscGlobalDofIdx() [2/2]

MoFEMErrorCode MoFEM::Problem::getColDofsByPetscGlobalDofIdx ( DofIdx  idx,
const NumeredDofEntity **  dof_ptr,
MoFEMTypes  bh = MF_EXIST 
) const

Get the Col Dofs By Petsc Global Dof Idx object.

Parameters
idx
dof_ptr
bh
Returns
MoFEMErrorCode

Definition at line 104 of file ProblemsMultiIndices.cpp.

105  {
107  auto weak_dof_ptr = getColDofsByPetscGlobalDofIdx(idx);
108  if (auto shared_dof_ptr = weak_dof_ptr.lock()) {
109  *dof_ptr = shared_dof_ptr.get();
110  } else {
111  if (bh == MF_EXIST)
112  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "row dof <%d> not found", idx);
113  *dof_ptr = nullptr;
114  }
116 }
@ MF_EXIST
Definition: definitions.h:189
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:516
@ MOFEM_NOT_FOUND
Definition: definitions.h:125
MoFEMErrorCode getColDofsByPetscGlobalDofIdx(DofIdx idx, const NumeredDofEntity **dof_ptr, MoFEMTypes bh=MF_EXIST) const
Get the Col Dofs By Petsc Global Dof Idx object.

◆ getColDofsSequence()

boost::shared_ptr<SequenceDofContainer>& MoFEM::Problem::getColDofsSequence ( ) const

Get reference to sequence data numbered dof container.

In sequence data container data are physically stored. The purpose of this is to allocate NumeredDofEntity data in bulk, having only one allocation instead each time entity is inserted. That makes code efficient.

The vector in sequence is destroyed if last entity inside that vector is destroyed. All MoFEM::NumeredDofEntity have aliased shared_ptr which points to the vector.

Returns
MoFEM::Problem::SequenceDofContainer

Definition at line 675 of file ProblemsMultiIndices.hpp.

675  {
677  }

◆ getComposedProblemsData()

boost::shared_ptr<ComposedProblemsData>& MoFEM::Problem::getComposedProblemsData ( ) const

Het composed problems data structure.

Definition at line 247 of file ProblemsMultiIndices.hpp.

247  {
248  return composedProblemsData;
249  }
boost::shared_ptr< ComposedProblemsData > composedProblemsData

◆ getDofByNameEntAndEntDofIdx()

MoFEMErrorCode MoFEM::Problem::getDofByNameEntAndEntDofIdx ( const int  field_bit_number,
const EntityHandle  ent,
const int  ent_dof_idx,
const RowColData  row_or_col,
boost::shared_ptr< NumeredDofEntity > &  dof_ptr 
) const

get DOFs from problem

Note that ent_dof_idx is not coefficient number, is local number of DOFs on the entity. The coefficient number and local index of DOFs or entity are the same on vertices and H1 approximation.

Parameters
field_bit_numberfield name field_bit_number = (use m_field.get_field_bit_number(field_name);
ententity handle
ent_dof_idxindex of DOFs on entity
row_or_colROW or COL
dof_ptrshared pointer to DOFs if found
Returns
error code

Definition at line 153 of file ProblemsMultiIndices.cpp.

156  {
158  decltype(numeredRowDofsPtr) numered_dofs;
159  switch (row_or_col) {
160  case ROW:
161  if (!numeredRowDofsPtr) {
162  SETERRQ(PETSC_COMM_SELF, MOFEM_INVALID_DATA,
163  "Row numbered index in problem not allocated");
164  }
165  numered_dofs = numeredRowDofsPtr;
166  break;
167  case COL:
168  if (!numeredColDofsPtr) {
169  SETERRQ(PETSC_COMM_SELF, MOFEM_INVALID_DATA,
170  "Col numbered index in problem not allocated");
171  }
172  numered_dofs = numeredColDofsPtr;
173  break;
174  default:
175  SETERRQ(PETSC_COMM_SELF, MOFEM_INVALID_DATA,
176  "Only ROW and COL is possible for 3rd argument");
177  }
178 
179  auto it =
180  numered_dofs->get<Unique_mi_tag>().find(DofEntity::getUniqueIdCalculate(
181  ent_dof_idx,
182  FieldEntity::getLocalUniqueIdCalculate(field_bit_number, ent)));
183  if (it != numered_dofs->get<Unique_mi_tag>().end()) {
184  dof_ptr = *it;
185  } else {
186  dof_ptr = boost::shared_ptr<NumeredDofEntity>();
187  }
189 }
@ COL
Definition: definitions.h:192
@ ROW
Definition: definitions.h:192
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415
@ MOFEM_INVALID_DATA
Definition: definitions.h:128
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
static UId getUniqueIdCalculate(const DofIdx dof, UId ent_uid)
UId getLocalUniqueIdCalculate()
Get the Local Unique Id Calculate object.

◆ getId()

BitProblemId MoFEM::Problem::getId ( ) const

Definition at line 525 of file ProblemsMultiIndices.hpp.

525 { return *((BitProblemId *)tagId); }
std::bitset< BITPROBLEMID_SIZE > BitProblemId
Problem Id.
Definition: Types.hpp:55

◆ getMaskBitRefLevel()

BitRefLevel MoFEM::Problem::getMaskBitRefLevel ( ) const

Definition at line 539 of file ProblemsMultiIndices.hpp.

539 { return *tagMaskBitRefLevel; }

◆ getName()

std::string MoFEM::Problem::getName ( ) const
Examples
EshelbianPlasticity.cpp, MagneticElement.hpp, Remodeling.cpp, field_evaluator.cpp, and lorentz_force.cpp.

Definition at line 527 of file ProblemsMultiIndices.hpp.

527  {
528  return std::string((char *)tagName, tagNameSize);
529  }

◆ getNbDofsCol()

DofIdx MoFEM::Problem::getNbDofsCol ( ) const

Definition at line 532 of file ProblemsMultiIndices.hpp.

532 { return nbDofsCol; }
DofIdx nbDofsCol
Global number of DOFs in col.

◆ getNbDofsRow()

DofIdx MoFEM::Problem::getNbDofsRow ( ) const

Definition at line 531 of file ProblemsMultiIndices.hpp.

531 { return nbDofsRow; }
DofIdx nbDofsRow
Global number of DOFs in row.

◆ getNbGhostDofsCol()

DofIdx MoFEM::Problem::getNbGhostDofsCol ( ) const

Definition at line 536 of file ProblemsMultiIndices.hpp.

536 { return nbGhostDofsCol; }
DofIdx nbGhostDofsCol
Number of ghost DOFs in col.

◆ getNbGhostDofsRow()

DofIdx MoFEM::Problem::getNbGhostDofsRow ( ) const

Definition at line 535 of file ProblemsMultiIndices.hpp.

535 { return nbGhostDofsRow; }
DofIdx nbGhostDofsRow
Number of ghost DOFs in row.

◆ getNbLocalDofsCol()

DofIdx MoFEM::Problem::getNbLocalDofsCol ( ) const

Definition at line 534 of file ProblemsMultiIndices.hpp.

534 { return nbLocDofsCol; }
DofIdx nbLocDofsCol
Local number of DOFs in colIs.

◆ getNbLocalDofsRow()

DofIdx MoFEM::Problem::getNbLocalDofsRow ( ) const

Definition at line 533 of file ProblemsMultiIndices.hpp.

533 { return nbLocDofsRow; }
DofIdx nbLocDofsRow
Local number of DOFs in row.

◆ getNumberOfElementsByNameAndPart()

MoFEMErrorCode MoFEM::Problem::getNumberOfElementsByNameAndPart ( MPI_Comm  comm,
const std::string  name,
PetscLayout *  layout 
) const

Get number of finite elements by name on processors.

Size retuned IS is equal to size of processors.

What PetscLayout see, http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/IS/index.html

Example of usage for layout

PetscInt rstart, rend;
ierr = PetscLayoutGetRange(layout, &rstart, &rend); CHKERRG(ierr);
int global_size;
ierr = PetscLayoutGetSize(layout,&global_size); CHKERRG(ierr);
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:552
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:87
Parameters
commCommunicator
nameFinite element name
layoutGet number of elements on each processor
Returns
error code

Definition at line 119 of file ProblemsMultiIndices.cpp.

120  {
122  int size, rank;
123  MPI_Comm_size(comm, &size);
124  MPI_Comm_rank(comm, &rank);
125  CHKERR PetscLayoutCreate(comm, layout);
126  CHKERR PetscLayoutSetBlockSize(*layout, 1);
127  const NumeredEntFiniteElementbyNameAndPart &fe_by_name_and_part =
128  numeredFiniteElementsPtr->get<Composite_Name_And_Part_mi_tag>();
129  int nb_elems;
130  nb_elems = fe_by_name_and_part.count(boost::make_tuple(name, rank));
131  CHKERR PetscLayoutSetLocalSize(*layout, nb_elems);
132  CHKERR PetscLayoutSetUp(*layout);
134 }
#define CHKERR
Inline error check.
Definition: definitions.h:604
NumeredEntFiniteElement_multiIndex::index< Composite_Name_And_Part_mi_tag >::type NumeredEntFiniteElementbyNameAndPart
Entity finite element multi-index by finite element name and partition.

◆ getNumberOfElementsByPart()

MoFEMErrorCode MoFEM::Problem::getNumberOfElementsByPart ( MPI_Comm  comm,
PetscLayout *  layout 
) const

Get number of finite elements on processors.

Size retuned IS is equal to size of processors.

What PetscLayout see, http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/IS/index.html

Example of usage for layout

PetscInt rstart, rend;
ierr = PetscLayoutGetRange(layout, &rstart, &rend); CHKERRG(ierr);
int global_size;
ierr = PetscLayoutGetSize(layout,&global_size); CHKERRG(ierr);
Parameters
commCommunicator
layoutGet number of elements on each processor
Returns
error code

Definition at line 136 of file ProblemsMultiIndices.cpp.

137  {
139  int size, rank;
140  MPI_Comm_size(comm, &size);
141  MPI_Comm_rank(comm, &rank);
142  CHKERR PetscLayoutCreate(comm, layout);
143  CHKERR PetscLayoutSetBlockSize(*layout, 1);
145  const FeByPart &fe_by_part = numeredFiniteElementsPtr->get<Part_mi_tag>();
146  int nb_elems;
147  nb_elems = fe_by_part.count(rank);
148  CHKERR PetscLayoutSetLocalSize(*layout, nb_elems);
149  CHKERR PetscLayoutSetUp(*layout);
151 }

◆ getNumeredColDofs()

DEPRECATED boost::shared_ptr<NumeredDofEntity_multiIndex>& MoFEM::Problem::getNumeredColDofs ( ) const

get access to numeredColDofsPtr storing DOFs on cols

Deprecated:
Use getNumeredColDofsPtr

Definition at line 140 of file ProblemsMultiIndices.hpp.

140  {
141  return numeredColDofsPtr;
142  }

◆ getNumeredColDofsBegin()

NumeredDofEntity_multiIndex::iterator MoFEM::Problem::getNumeredColDofsBegin ( ) const

get begin iterator for numeredColDofsPtr (insted you can use #_IT_NUMEREDDOFMOFEMENTITY_COL_FOR_LOOP_ for loops)

Definition at line 346 of file ProblemsMultiIndices.hpp.

346  {
347  return numeredColDofsPtr->begin();
348  }

◆ getNumeredColDofsByEntBegin()

NumeredDofEntityByEnt::iterator MoFEM::Problem::getNumeredColDofsByEntBegin ( const EntityHandle  ent) const

get begin iterator for numeredColDofsPtr (insted you can use _IT_NUMEREDDOF_COL_BY_ENT_FOR_LOOP_ for loops)

Definition at line 470 of file ProblemsMultiIndices.hpp.

470  {
471  return numeredColDofsPtr->get<Ent_mi_tag>().lower_bound(ent);
472  }

◆ getNumeredColDofsByEntEnd()

NumeredDofEntityByEnt::iterator MoFEM::Problem::getNumeredColDofsByEntEnd ( const EntityHandle  ent) const

get end iterator for numeredColDofsPtr (insted you can use _IT_NUMEREDDOF_COL_BY_ENT_FOR_LOOP_ for loops)

Definition at line 477 of file ProblemsMultiIndices.hpp.

477  {
478  return numeredColDofsPtr->get<Ent_mi_tag>().upper_bound(ent);
479  }

◆ getNumeredColDofsByLocIdxBegin()

NumeredDofEntityByLocalIdx::iterator MoFEM::Problem::getNumeredColDofsByLocIdxBegin ( const DofIdx  locidx) const

get begin iterator for numeredColDofsPtr (insted you can use _IT_NUMEREDDOF_COL_FOR_LOOP_ for loops)

Definition at line 408 of file ProblemsMultiIndices.hpp.

408  {
409  return numeredColDofsPtr->get<PetscLocalIdx_mi_tag>().lower_bound(locidx);
410  }

◆ getNumeredColDofsByLocIdxEnd()

NumeredDofEntityByLocalIdx::iterator MoFEM::Problem::getNumeredColDofsByLocIdxEnd ( const DofIdx  locidx) const

get end iterator for numeredColDofsPtr (insted you can use _IT_NUMEREDDOF_COL_FOR_LOOP_ for loops)

Definition at line 415 of file ProblemsMultiIndices.hpp.

415  {
416  return numeredColDofsPtr->get<PetscLocalIdx_mi_tag>().upper_bound(locidx);
417  }

◆ getNumeredColDofsEnd()

NumeredDofEntity_multiIndex::iterator MoFEM::Problem::getNumeredColDofsEnd ( ) const

get end iterator for numeredColDofsPtr (insted you can use #_IT_NUMEREDDOFMOFEMENTITY_COL_FOR_LOOP_ for loops)

Definition at line 352 of file ProblemsMultiIndices.hpp.

352  {
353  return numeredColDofsPtr->end();
354  }

◆ getNumeredColDofsPtr()

boost::shared_ptr<NumeredDofEntity_multiIndex>& MoFEM::Problem::getNumeredColDofsPtr ( ) const

get access to numeredColDofsPtr storing DOFs on cols

Definition at line 114 of file ProblemsMultiIndices.hpp.

114  {
115  return numeredColDofsPtr;
116  }

◆ getNumeredFEsBegin()

NumeredEntFiniteElementbyName::iterator MoFEM::Problem::getNumeredFEsBegin ( std::string  fe_name) const

Definition at line 287 of file ProblemsMultiIndices.hpp.

287  {
288  return numeredFiniteElementsPtr->get<FiniteElement_name_mi_tag>()
289  .lower_bound(fe_name);
290  }

◆ getNumeredFEsEnd()

NumeredEntFiniteElementbyName::iterator MoFEM::Problem::getNumeredFEsEnd ( std::string  fe_name) const

Definition at line 293 of file ProblemsMultiIndices.hpp.

293  {
294  return numeredFiniteElementsPtr->get<FiniteElement_name_mi_tag>()
295  .upper_bound(fe_name);
296  }

◆ getNumeredFiniteElements()

const boost::shared_ptr<NumeredEntFiniteElement_multiIndex>& DEPRECATED MoFEM::Problem::getNumeredFiniteElements ( ) const

get access to reference for multi-index storing finite elements

Deprecated:
getNumeredFiniteElementsPtr

Definition at line 149 of file ProblemsMultiIndices.hpp.

149  {
151  }

◆ getNumeredFiniteElementsPtr()

const boost::shared_ptr<NumeredEntFiniteElement_multiIndex>& MoFEM::Problem::getNumeredFiniteElementsPtr ( ) const

get access to reference for multi-index storing finite elements

Definition at line 122 of file ProblemsMultiIndices.hpp.

122  {
124  }

◆ getNumeredRowDofs()

DEPRECATED boost::shared_ptr<NumeredDofEntity_multiIndex>& MoFEM::Problem::getNumeredRowDofs ( ) const

get access to numeredRowDofsPtr storing DOFs on rows \deprected Use getNumeredRowDofsPtr

Definition at line 131 of file ProblemsMultiIndices.hpp.

131  {
132  return numeredRowDofsPtr;
133  }

◆ getNumeredRowDofsBegin()

NumeredDofEntity_multiIndex::iterator MoFEM::Problem::getNumeredRowDofsBegin ( ) const

get begin iterator for numeredRowDofsPtr (insted you can use #_IT_NUMEREDDOFMOFEMENTITY_ROW_FOR_LOOP_ for loops)

Definition at line 334 of file ProblemsMultiIndices.hpp.

334  {
335  return numeredRowDofsPtr->begin();
336  }

◆ getNumeredRowDofsByEntBegin()

NumeredDofEntityByEnt::iterator MoFEM::Problem::getNumeredRowDofsByEntBegin ( const EntityHandle  ent) const

get begin iterator for numeredRowDofsPtr (insted you can use _IT_NUMEREDDOF_ROW_BY_ENT_FOR_LOOP_ for loops)

Definition at line 456 of file ProblemsMultiIndices.hpp.

456  {
457  return numeredRowDofsPtr->get<Ent_mi_tag>().lower_bound(ent);
458  }

◆ getNumeredRowDofsByEntEnd()

NumeredDofEntityByEnt::iterator MoFEM::Problem::getNumeredRowDofsByEntEnd ( const EntityHandle  ent) const

get end iterator for numeredRowDofsPtr (insted you can use _IT_NUMEREDDOF_ROW_BY_ENT_FOR_LOOP_ for loops)

Definition at line 463 of file ProblemsMultiIndices.hpp.

463  {
464  return numeredRowDofsPtr->get<Ent_mi_tag>().upper_bound(ent);
465  }

◆ getNumeredRowDofsByLocIdxBegin()

NumeredDofEntityByLocalIdx::iterator MoFEM::Problem::getNumeredRowDofsByLocIdxBegin ( const DofIdx  locidx) const

get begin iterator for numeredRowDofsPtr (insted you can use _IT_NUMEREDDOF_ROW_FOR_LOOP_ for loops)

Definition at line 394 of file ProblemsMultiIndices.hpp.

394  {
395  return numeredRowDofsPtr->get<PetscLocalIdx_mi_tag>().lower_bound(locidx);
396  }

◆ getNumeredRowDofsByLocIdxEnd()

NumeredDofEntityByLocalIdx::iterator MoFEM::Problem::getNumeredRowDofsByLocIdxEnd ( const DofIdx  locidx) const

get end iterator for numeredRowDofsPtr (insted you can use _IT_NUMEREDDOF_ROW_FOR_LOOP_ for loops)

Definition at line 401 of file ProblemsMultiIndices.hpp.

401  {
402  return numeredRowDofsPtr->get<PetscLocalIdx_mi_tag>().upper_bound(locidx);
403  }

◆ getNumeredRowDofsEnd()

NumeredDofEntity_multiIndex::iterator MoFEM::Problem::getNumeredRowDofsEnd ( ) const

get end iterator for numeredRowDofsPtr (insted you can use #_IT_NUMEREDDOFMOFEMENTITY_ROW_FOR_LOOP_ for loops)

Definition at line 340 of file ProblemsMultiIndices.hpp.

340  {
341  return numeredRowDofsPtr->end();
342  }

◆ getNumeredRowDofsPtr()

boost::shared_ptr<NumeredDofEntity_multiIndex>& MoFEM::Problem::getNumeredRowDofsPtr ( ) const

get access to numeredRowDofsPtr storing DOFs on rows

Examples
test_cache_on_entities.cpp.

Definition at line 107 of file ProblemsMultiIndices.hpp.

107  {
108  return numeredRowDofsPtr;
109  }

◆ getRowDofsByPetscGlobalDofIdx() [1/2]

boost::weak_ptr< NumeredDofEntity > MoFEM::Problem::getRowDofsByPetscGlobalDofIdx ( DofIdx  idx) const

Get the Row Dofs By Petsc Global Dof Idx object.

Parameters
idx
Returns
boost::weak_ptr<NumeredDofEntity>

Definition at line 69 of file ProblemsMultiIndices.cpp.

69  {
71  boost::weak_ptr<NumeredDofEntity> dof_weak_ptr;
72  NumeredDofEntity_multiIndex::index<PetscGlobalIdx_mi_tag>::type::iterator dit;
73  dit = numeredRowDofsPtr->get<PetscGlobalIdx_mi_tag>().find(idx);
74  if (dit != numeredRowDofsPtr->get<PetscGlobalIdx_mi_tag>().end())
75  dof_weak_ptr = *dit;
76  return dof_weak_ptr;
77 }

◆ getRowDofsByPetscGlobalDofIdx() [2/2]

MoFEMErrorCode MoFEM::Problem::getRowDofsByPetscGlobalDofIdx ( DofIdx  idx,
const NumeredDofEntity **  dof_ptr,
MoFEMTypes  bh = MF_EXIST 
) const

Get the Row Dofs By Petsc Global Dof Idx object.

Parameters
idx
dof_ptr
bh
Returns
MoFEMErrorCode

Definition at line 90 of file ProblemsMultiIndices.cpp.

91  {
93  auto weak_dof_ptr = getRowDofsByPetscGlobalDofIdx(idx);
94  if (auto shared_dof_ptr = weak_dof_ptr.lock()) {
95  *dof_ptr = shared_dof_ptr.get();
96  } else {
97  if (bh == MF_EXIST)
98  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "row dof <%d> not found", idx);
99  *dof_ptr = nullptr;
100  }
102 }
MoFEMErrorCode getRowDofsByPetscGlobalDofIdx(DofIdx idx, const NumeredDofEntity **dof_ptr, MoFEMTypes bh=MF_EXIST) const
Get the Row Dofs By Petsc Global Dof Idx object.

◆ getRowDofsSequence()

boost::shared_ptr<SequenceDofContainer>& MoFEM::Problem::getRowDofsSequence ( ) const

Get reference to sequence data numbered dof container.

In sequence data container data are physically stored. The purpose of this is to allocate NumeredDofEntity data in bulk, having only one allocation instead each time entity is inserted. That makes code efficient.

The vector in sequence is destroyed if last entity inside that vector is destroyed. All MoFEM::NumeredDofEntity have aliased shared_ptr which points to the vector.

Returns
MoFEM::Problem::SequenceDofContainer

Definition at line 657 of file ProblemsMultiIndices.hpp.

657  {
659  }

◆ getSubData()

boost::shared_ptr<SubProblemData>& MoFEM::Problem::getSubData ( ) const

Get main problem of sub-problem is.

Returns
sub problem data structure
Examples
cell_forces.cpp.

Definition at line 234 of file ProblemsMultiIndices.hpp.

234  {
235  return subProblemData;
236  }
boost::shared_ptr< SubProblemData > subProblemData

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Problem e 
)
friend

Definition at line 60 of file ProblemsMultiIndices.cpp.

60  {
61  os << "problem id " << e.getId() << " FiniteElement id " << e.getBitFEId()
62  << " name " << e.getName();
63  return os;
64 }

Member Data Documentation

◆ composedProblemsData

boost::shared_ptr<ComposedProblemsData> MoFEM::Problem::composedProblemsData
mutable

Pointer to data structure from which this problem is composed

Definition at line 241 of file ProblemsMultiIndices.hpp.

◆ meshset

EntityHandle MoFEM::Problem::meshset

Problem meshset (on tag of this meshset all data related to problem are stored)

Definition at line 81 of file ProblemsMultiIndices.hpp.

◆ nbDofsCol

DofIdx MoFEM::Problem::nbDofsCol
mutable

Global number of DOFs in col.

Definition at line 91 of file ProblemsMultiIndices.hpp.

◆ nbDofsRow

DofIdx MoFEM::Problem::nbDofsRow
mutable

Global number of DOFs in row.

Definition at line 90 of file ProblemsMultiIndices.hpp.

◆ nbGhostDofsCol

DofIdx MoFEM::Problem::nbGhostDofsCol
mutable

Number of ghost DOFs in col.

Definition at line 95 of file ProblemsMultiIndices.hpp.

◆ nbGhostDofsRow

DofIdx MoFEM::Problem::nbGhostDofsRow
mutable

Number of ghost DOFs in row.

Definition at line 94 of file ProblemsMultiIndices.hpp.

◆ nbLocDofsCol

DofIdx MoFEM::Problem::nbLocDofsCol
mutable

Local number of DOFs in colIs.

Definition at line 93 of file ProblemsMultiIndices.hpp.

◆ nbLocDofsRow

DofIdx MoFEM::Problem::nbLocDofsRow
mutable

Local number of DOFs in row.

Definition at line 92 of file ProblemsMultiIndices.hpp.

◆ numeredColDofsPtr

boost::shared_ptr<NumeredDofEntity_multiIndex> MoFEM::Problem::numeredColDofsPtr
mutable

store DOFs on columns for this problem

Definition at line 100 of file ProblemsMultiIndices.hpp.

◆ numeredFiniteElementsPtr

boost::shared_ptr<NumeredEntFiniteElement_multiIndex> MoFEM::Problem::numeredFiniteElementsPtr
mutable

store finite elements

Definition at line 102 of file ProblemsMultiIndices.hpp.

◆ numeredRowDofsPtr

boost::shared_ptr<NumeredDofEntity_multiIndex> MoFEM::Problem::numeredRowDofsPtr
mutable

store DOFs on rows for this problem

Definition at line 98 of file ProblemsMultiIndices.hpp.

◆ sequenceColDofContainer

boost::shared_ptr<SequenceDofContainer> MoFEM::Problem::sequenceColDofContainer
mutableprivate

Definition at line 682 of file ProblemsMultiIndices.hpp.

◆ sequenceRowDofContainer

boost::shared_ptr<SequenceDofContainer> MoFEM::Problem::sequenceRowDofContainer
mutableprivate

Definition at line 681 of file ProblemsMultiIndices.hpp.

◆ subProblemData

boost::shared_ptr<SubProblemData> MoFEM::Problem::subProblemData
mutable

Pointer to data structure. This pointer has allocated data only for sub problems.

Examples
EshelbianPlasticity.cpp.

Definition at line 228 of file ProblemsMultiIndices.hpp.

◆ tagBitFEId

BitFEId* MoFEM::Problem::tagBitFEId

IDs of finite elements in problem.

Definition at line 86 of file ProblemsMultiIndices.hpp.

◆ tagBitRefLevel

BitRefLevel* MoFEM::Problem::tagBitRefLevel

BitRef level of finite elements in problem.

Definition at line 87 of file ProblemsMultiIndices.hpp.

◆ tagId

BitProblemId* MoFEM::Problem::tagId

Unique problem ID.

Definition at line 83 of file ProblemsMultiIndices.hpp.

◆ tagMaskBitRefLevel

BitRefLevel* MoFEM::Problem::tagMaskBitRefLevel

BItRefMask of elements in problem.

Definition at line 88 of file ProblemsMultiIndices.hpp.

◆ tagName

const char* MoFEM::Problem::tagName

Problem name.

Definition at line 84 of file ProblemsMultiIndices.hpp.

◆ tagNameSize

int MoFEM::Problem::tagNameSize

Size of problem name.

Definition at line 85 of file ProblemsMultiIndices.hpp.


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