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

keeps basic data about problemThis is low level structure with information about problem, what elements compose problem and what DOFs are on rows and columns. More...

#include <src/multi_indices/ProblemsMultiIndices.hpp>

Collaboration diagram for MoFEM::Problem:
[legend]

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
cell_forces.cpp, EshelbianPlasticity.cpp, field_evaluator.cpp, loop_entities.cpp, lorentz_force.cpp, MagneticElement.hpp, Remodeling.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 643 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 }
int tagNameSize
Size of problem name.
BitProblemId * tagId
Unique problem ID.
const char * tagName
Problem name.
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredRowDofsPtr
store DOFs on rows for this problem
#define MOAB_THROW(a)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:610
BitFEId * tagBitFEId
IDs of finite elements in problem.
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.
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:85
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.
BitRefLevel * tagMaskBitRefLevel
BItRefMask of elements in problem.
boost::shared_ptr< NumeredEntFiniteElement_multiIndex > numeredFiniteElementsPtr
store finite elements
BitRefLevel * tagBitRefLevel
BitRef level of finite elements in problem.
boost::shared_ptr< SequenceDofContainer > sequenceColDofContainer
boost::shared_ptr< SequenceDofContainer > sequenceRowDofContainer
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredColDofsPtr
store DOFs on columns for this problem
multi_index_container< boost::weak_ptr< std::vector< NumeredDofEntity > >, indexed_by< sequenced<> > > SequenceDofContainer

◆ ~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; }
BitFEId * tagBitFEId
IDs of finite elements in problem.

◆ getBitRefLevel()

BitRefLevel MoFEM::Problem::getBitRefLevel ( ) const

Definition at line 540 of file ProblemsMultiIndices.hpp.

540 { return *tagBitRefLevel; }
BitRefLevel * tagBitRefLevel
BitRef level of finite elements in problem.

◆ getColDofsByPetscGlobalDofIdx() [1/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 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:509
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:516
MoFEMErrorCode getColDofsByPetscGlobalDofIdx(DofIdx idx, const NumeredDofEntity **dof_ptr, MoFEMTypes bh=MF_EXIST) const
Get the Col Dofs By Petsc Global Dof Idx object.

◆ getColDofsByPetscGlobalDofIdx() [2/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
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredColDofsPtr
store DOFs on columns for this problem

◆ 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 677 of file ProblemsMultiIndices.hpp.

677  {
679  }
boost::shared_ptr< SequenceDofContainer > sequenceColDofContainer

◆ getComposedProblemsData()

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

Het composed problems data structure.

Definition at line 249 of file ProblemsMultiIndices.hpp.

249  {
250  return composedProblemsData;
251  }
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
Examples
cell_forces.cpp.

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 }
UId getLocalUniqueIdCalculate()
Get the Local Unique Id Calculate object.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredRowDofsPtr
store DOFs on rows for this problem
static UId getUniqueIdCalculate(const DofIdx dof, UId ent_uid)
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredColDofsPtr
store DOFs on columns for this problem
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

◆ getId()

BitProblemId MoFEM::Problem::getId ( ) const

Definition at line 527 of file ProblemsMultiIndices.hpp.

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

◆ getMaskBitRefLevel()

BitRefLevel MoFEM::Problem::getMaskBitRefLevel ( ) const

Definition at line 541 of file ProblemsMultiIndices.hpp.

541 { return *tagMaskBitRefLevel; }
BitRefLevel * tagMaskBitRefLevel
BItRefMask of elements in problem.

◆ getName()

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

Definition at line 529 of file ProblemsMultiIndices.hpp.

529  {
530  return std::string((char *)tagName, tagNameSize);
531  }
int tagNameSize
Size of problem name.
const char * tagName
Problem name.

◆ getNbDofsCol()

DofIdx MoFEM::Problem::getNbDofsCol ( ) const

Definition at line 534 of file ProblemsMultiIndices.hpp.

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

◆ getNbDofsRow()

DofIdx MoFEM::Problem::getNbDofsRow ( ) const

Definition at line 533 of file ProblemsMultiIndices.hpp.

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

◆ getNbGhostDofsCol()

DofIdx MoFEM::Problem::getNbGhostDofsCol ( ) const

Definition at line 538 of file ProblemsMultiIndices.hpp.

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

◆ getNbGhostDofsRow()

DofIdx MoFEM::Problem::getNbGhostDofsRow ( ) const

Definition at line 537 of file ProblemsMultiIndices.hpp.

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

◆ getNbLocalDofsCol()

DofIdx MoFEM::Problem::getNbLocalDofsCol ( ) const

Definition at line 536 of file ProblemsMultiIndices.hpp.

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

◆ getNbLocalDofsRow()

DofIdx MoFEM::Problem::getNbLocalDofsRow ( ) const

Definition at line 535 of file ProblemsMultiIndices.hpp.

535 { 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);
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 MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
NumeredEntFiniteElement_multiIndex::index< Composite_Name_And_Part_mi_tag >::type NumeredEntFiniteElementbyNameAndPart
Entity finite element multi-index by finite element name and partition.
boost::shared_ptr< NumeredEntFiniteElement_multiIndex > numeredFiniteElementsPtr
store finite elements
#define CHKERR
Inline error check.
Definition: definitions.h:604
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

◆ 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 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
boost::shared_ptr< NumeredEntFiniteElement_multiIndex > numeredFiniteElementsPtr
store finite elements
#define CHKERR
Inline error check.
Definition: definitions.h:604
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

◆ 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  }
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredColDofsPtr
store DOFs on columns for this problem

◆ 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 348 of file ProblemsMultiIndices.hpp.

348  {
349  return numeredColDofsPtr->begin();
350  }
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredColDofsPtr
store DOFs on columns for this problem

◆ 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 472 of file ProblemsMultiIndices.hpp.

472  {
473  return numeredColDofsPtr->get<Ent_mi_tag>().lower_bound(ent);
474  }
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredColDofsPtr
store DOFs on columns for this problem

◆ 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 479 of file ProblemsMultiIndices.hpp.

479  {
480  return numeredColDofsPtr->get<Ent_mi_tag>().upper_bound(ent);
481  }
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredColDofsPtr
store DOFs on columns for this problem

◆ 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 410 of file ProblemsMultiIndices.hpp.

410  {
411  return numeredColDofsPtr->get<PetscLocalIdx_mi_tag>().lower_bound(locidx);
412  }
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredColDofsPtr
store DOFs on columns for this problem

◆ 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 417 of file ProblemsMultiIndices.hpp.

417  {
418  return numeredColDofsPtr->get<PetscLocalIdx_mi_tag>().upper_bound(locidx);
419  }
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredColDofsPtr
store DOFs on columns for this problem

◆ 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 354 of file ProblemsMultiIndices.hpp.

354  {
355  return numeredColDofsPtr->end();
356  }
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredColDofsPtr
store DOFs on columns for this problem

◆ 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  }
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredColDofsPtr
store DOFs on columns for this problem

◆ getNumeredFEsBegin()

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

Definition at line 289 of file ProblemsMultiIndices.hpp.

289  {
290  return numeredFiniteElementsPtr->get<FiniteElement_name_mi_tag>()
291  .lower_bound(fe_name);
292  }
boost::shared_ptr< NumeredEntFiniteElement_multiIndex > numeredFiniteElementsPtr
store finite elements

◆ getNumeredFEsEnd()

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

Definition at line 295 of file ProblemsMultiIndices.hpp.

295  {
296  return numeredFiniteElementsPtr->get<FiniteElement_name_mi_tag>()
297  .upper_bound(fe_name);
298  }
boost::shared_ptr< NumeredEntFiniteElement_multiIndex > numeredFiniteElementsPtr
store finite elements

◆ 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  }
boost::shared_ptr< NumeredEntFiniteElement_multiIndex > numeredFiniteElementsPtr
store finite elements

◆ 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  }
boost::shared_ptr< NumeredEntFiniteElement_multiIndex > numeredFiniteElementsPtr
store finite elements

◆ 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  }
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredRowDofsPtr
store DOFs on rows for this problem

◆ 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 336 of file ProblemsMultiIndices.hpp.

336  {
337  return numeredRowDofsPtr->begin();
338  }
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredRowDofsPtr
store DOFs on rows for this problem

◆ 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 458 of file ProblemsMultiIndices.hpp.

458  {
459  return numeredRowDofsPtr->get<Ent_mi_tag>().lower_bound(ent);
460  }
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredRowDofsPtr
store DOFs on rows for this problem

◆ 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 465 of file ProblemsMultiIndices.hpp.

465  {
466  return numeredRowDofsPtr->get<Ent_mi_tag>().upper_bound(ent);
467  }
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredRowDofsPtr
store DOFs on rows for this problem

◆ 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 396 of file ProblemsMultiIndices.hpp.

396  {
397  return numeredRowDofsPtr->get<PetscLocalIdx_mi_tag>().lower_bound(locidx);
398  }
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredRowDofsPtr
store DOFs on rows for this problem

◆ 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 403 of file ProblemsMultiIndices.hpp.

403  {
404  return numeredRowDofsPtr->get<PetscLocalIdx_mi_tag>().upper_bound(locidx);
405  }
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredRowDofsPtr
store DOFs on rows for this problem

◆ 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 342 of file ProblemsMultiIndices.hpp.

342  {
343  return numeredRowDofsPtr->end();
344  }
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredRowDofsPtr
store DOFs on rows for this problem

◆ getNumeredRowDofsPtr()

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

get access to numeredRowDofsPtr storing DOFs on rows

Definition at line 107 of file ProblemsMultiIndices.hpp.

107  {
108  return numeredRowDofsPtr;
109  }
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredRowDofsPtr
store DOFs on rows for this problem

◆ getRowDofsByPetscGlobalDofIdx() [1/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 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:509
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:516
MoFEMErrorCode getRowDofsByPetscGlobalDofIdx(DofIdx idx, const NumeredDofEntity **dof_ptr, MoFEMTypes bh=MF_EXIST) const
Get the Row Dofs By Petsc Global Dof Idx object.

◆ getRowDofsByPetscGlobalDofIdx() [2/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 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:509
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredRowDofsPtr
store DOFs on rows for this problem

◆ 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 659 of file ProblemsMultiIndices.hpp.

659  {
661  }
boost::shared_ptr< SequenceDofContainer > sequenceRowDofContainer

◆ 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 236 of file ProblemsMultiIndices.hpp.

236  {
237  return subProblemData;
238  }
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 243 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 684 of file ProblemsMultiIndices.hpp.

◆ sequenceRowDofContainer

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

Definition at line 683 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 230 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: