v0.13.1
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
 
using EmptyFieldBlocks = std::pair< BitFieldId, BitFieldId >
 

Public Member Functions

auto & getNumeredRowDofsPtr () const
 get access to numeredRowDofsPtr storing DOFs on rows More...
 
auto & getNumeredColDofsPtr () const
 get access to numeredColDofsPtr storing DOFs on cols More...
 
const auto & getNumeredFiniteElementsPtr () 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...
 
auto & 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...
 
auto getNumeredFEsBegin (std::string fe_name) const
 
auto 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
 
auto getNumeredRowDofsByLocIdxBegin (const DofIdx locidx) const
 
auto getNumeredRowDofsByLocIdxEnd (const DofIdx locidx) const
 
auto getNumeredColDofsByLocIdxBegin (const DofIdx locidx) const
 
auto getNumeredColDofsByLocIdxEnd (const DofIdx locidx) const
 
auto getNumeredRowDofsByEntBegin (const EntityHandle ent) const
 
auto getNumeredRowDofsByEntEnd (const EntityHandle ent) const
 
auto getNumeredColDofsByEntBegin (const EntityHandle ent) const
 
auto getNumeredColDofsByEntEnd (const EntityHandle ent) const
 
 Problem (Interface &moab, const EntityHandle meshset)
 
virtual ~Problem ()=default
 
BitProblemId getId () const
 
auto getName () const
 
DofIdx getNbDofsRow () const
 
DofIdx getNbDofsCol () const
 
DofIdx getNbLocalDofsRow () const
 
DofIdx getNbLocalDofsCol () const
 
DofIdx getNbGhostDofsRow () const
 
DofIdx getNbGhostDofsCol () const
 
BitRefLevel getBitRefLevel () const
 
BitRefLevel getBitRefLevelMask () 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...
 
auto & getRowDofsSequence () const
 Get reference to sequence data numbered dof container. More...
 
auto & getColDofsSequence () const
 Get reference to sequence data numbered dof container. More...
 
EmptyFieldBlocksgetEmptyFieldBlocks () const
 Get the empty field blocks. More...
 
EmptyFieldBlocksaddFieldToEmptyFieldBlocks (const EmptyFieldBlocks add_fields) const
 Add fields to the empty field blocks. 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...
 
BitRefLeveltagBitRefLevelMask
 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
 
EmptyFieldBlocks emptyFieldBlocks
 

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, cell_forces.cpp, field_evaluator.cpp, loop_entities.cpp, lorentz_force.cpp, nonlinear_dynamics.cpp, partition_mesh.cpp, poisson_2d_dis_galerkin.cpp, and test_cache_on_entities.cpp.

Definition at line 54 of file ProblemsMultiIndices.hpp.

Member Typedef Documentation

◆ EmptyFieldBlocks

Definition at line 540 of file ProblemsMultiIndices.hpp.

◆ SequenceDofContainer

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

Definition at line 506 of file ProblemsMultiIndices.hpp.

Constructor & Destructor Documentation

◆ Problem()

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

Definition at line 31 of file ProblemsMultiIndices.cpp.

37 ErrorCode rval;
38 Tag th_ProblemId;
39 rval = moab.tag_get_handle("_ProblemId", th_ProblemId);
41 rval = moab.tag_get_by_ptr(th_ProblemId, &meshset, 1, (const void **)&tagId);
43 Tag th_ProblemName;
44 rval = moab.tag_get_handle("_ProblemName", th_ProblemName);
46 rval = moab.tag_get_by_ptr(th_ProblemName, &meshset, 1,
47 (const void **)&tagName, &tagNameSize);
49 Tag th_ProblemFEId;
50 rval = moab.tag_get_handle("_ProblemFEId", th_ProblemFEId);
52 rval = moab.tag_get_by_ptr(th_ProblemFEId, &meshset, 1,
53 (const void **)&tagBitFEId);
55 Tag th_RefBitLevel;
56 rval = moab.tag_get_handle("_RefBitLevel", th_RefBitLevel);
58 rval = moab.tag_get_by_ptr(th_RefBitLevel, &meshset, 1,
59 (const void **)&tagBitRefLevel);
61 Tag th_RefBitLevel_Mask;
62 rval = moab.tag_get_handle("_RefBitLevelMask", th_RefBitLevel_Mask);
64 rval = moab.tag_get_by_ptr(th_RefBitLevel_Mask, &meshset, 1,
65 (const void **)&tagBitRefLevelMask);
67}
#define MOAB_THROW(err)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:554
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.
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.
BitRefLevel * tagBitRefLevelMask
BItRefMask of 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

◆ addFieldToEmptyFieldBlocks()

EmptyFieldBlocks & MoFEM::Problem::addFieldToEmptyFieldBlocks ( const EmptyFieldBlocks  add_fields) const

Add fields to the empty field blocks.

Emtpy field blocks is a pair contains IDs of the fields for which matrix has zero entries.

Parameters
add_fields
Returns
EmptyFieldBlocks&

Definition at line 564 of file ProblemsMultiIndices.hpp.

564 {
565 emptyFieldBlocks.first |= add_fields.first;
566 emptyFieldBlocks.second |= add_fields.second;
567 return emptyFieldBlocks;
568 }
EmptyFieldBlocks emptyFieldBlocks

◆ getBitFEId()

BitFEId MoFEM::Problem::getBitFEId ( ) const

Definition at line 77 of file ProblemsMultiIndices.cpp.

77{ return *tagBitFEId; }

◆ getBitRefLevel()

BitRefLevel MoFEM::Problem::getBitRefLevel ( ) const

Definition at line 399 of file ProblemsMultiIndices.hpp.

399{ return *tagBitRefLevel; }

◆ getBitRefLevelMask()

BitRefLevel MoFEM::Problem::getBitRefLevelMask ( ) const

Definition at line 400 of file ProblemsMultiIndices.hpp.

400{ return *tagBitRefLevelMask; }

◆ 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 91 of file ProblemsMultiIndices.cpp.

91 {
93 boost::weak_ptr<NumeredDofEntity> dof_weak_ptr;
94 NumeredDofEntity_multiIndex::index<PetscGlobalIdx_mi_tag>::type::iterator dit;
95 dit = numeredColDofsPtr->get<PetscGlobalIdx_mi_tag>().find(idx);
96 if (dit != numeredColDofsPtr->get<PetscGlobalIdx_mi_tag>().end())
97 dof_weak_ptr = *dit;
98 return dof_weak_ptr;
99}
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453

◆ 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 115 of file ProblemsMultiIndices.cpp.

116 {
118 auto weak_dof_ptr = getColDofsByPetscGlobalDofIdx(idx);
119 if (auto shared_dof_ptr = weak_dof_ptr.lock()) {
120 *dof_ptr = shared_dof_ptr.get();
121 } else {
122 if (bh == MF_EXIST)
123 SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "row dof <%d> not found", idx);
124 *dof_ptr = nullptr;
125 }
127}
@ MF_EXIST
Definition: definitions.h:113
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
@ MOFEM_NOT_FOUND
Definition: definitions.h:46
MoFEMErrorCode getColDofsByPetscGlobalDofIdx(DofIdx idx, const NumeredDofEntity **dof_ptr, MoFEMTypes bh=MF_EXIST) const
Get the Col Dofs By Petsc Global Dof Idx object.

◆ getColDofsSequence()

auto & 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 538 of file ProblemsMultiIndices.hpp.

538{ return sequenceColDofContainer; }

◆ getComposedProblemsData()

auto & MoFEM::Problem::getComposedProblemsData ( ) const

Het composed problems data structure.

Definition at line 123 of file ProblemsMultiIndices.hpp.

123{ return composedProblemsData; }
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 164 of file ProblemsMultiIndices.cpp.

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

◆ getEmptyFieldBlocks()

EmptyFieldBlocks & MoFEM::Problem::getEmptyFieldBlocks ( ) const

Get the empty field blocks.

Emtpy field blocks is a pair contains IDs of the fields for which matrix has zero entries.

Returns
EmptyFieldBlocks&

Definition at line 550 of file ProblemsMultiIndices.hpp.

550 {
551 return emptyFieldBlocks;
552 }

◆ getId()

BitProblemId MoFEM::Problem::getId ( ) const

Definition at line 386 of file ProblemsMultiIndices.hpp.

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

◆ getName()

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

Definition at line 388 of file ProblemsMultiIndices.hpp.

388 {
389 return std::string((char *)tagName, tagNameSize);
390 }

◆ getNbDofsCol()

DofIdx MoFEM::Problem::getNbDofsCol ( ) const

Definition at line 393 of file ProblemsMultiIndices.hpp.

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

◆ getNbDofsRow()

DofIdx MoFEM::Problem::getNbDofsRow ( ) const
Examples
nonlinear_dynamics.cpp, and poisson_2d_dis_galerkin.cpp.

Definition at line 392 of file ProblemsMultiIndices.hpp.

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

◆ getNbGhostDofsCol()

DofIdx MoFEM::Problem::getNbGhostDofsCol ( ) const

Definition at line 397 of file ProblemsMultiIndices.hpp.

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

◆ getNbGhostDofsRow()

DofIdx MoFEM::Problem::getNbGhostDofsRow ( ) const

Definition at line 396 of file ProblemsMultiIndices.hpp.

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

◆ getNbLocalDofsCol()

DofIdx MoFEM::Problem::getNbLocalDofsCol ( ) const
Examples
nonlinear_dynamics.cpp.

Definition at line 395 of file ProblemsMultiIndices.hpp.

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

◆ getNbLocalDofsRow()

DofIdx MoFEM::Problem::getNbLocalDofsRow ( ) const
Examples
nonlinear_dynamics.cpp.

Definition at line 394 of file ProblemsMultiIndices.hpp.

394{ 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:496
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 130 of file ProblemsMultiIndices.cpp.

131 {
133 int size, rank;
134 MPI_Comm_size(comm, &size);
135 MPI_Comm_rank(comm, &rank);
136 CHKERR PetscLayoutCreate(comm, layout);
137 CHKERR PetscLayoutSetBlockSize(*layout, 1);
138 const auto &fe_by_name_and_part =
139 numeredFiniteElementsPtr->get<Composite_Name_And_Part_mi_tag>();
140 int nb_elems;
141 nb_elems = fe_by_name_and_part.count(boost::make_tuple(name, rank));
142 CHKERR PetscLayoutSetLocalSize(*layout, nb_elems);
143 CHKERR PetscLayoutSetUp(*layout);
145}
#define CHKERR
Inline error check.
Definition: definitions.h:548

◆ 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 147 of file ProblemsMultiIndices.cpp.

148 {
150 int size, rank;
151 MPI_Comm_size(comm, &size);
152 MPI_Comm_rank(comm, &rank);
153 CHKERR PetscLayoutCreate(comm, layout);
154 CHKERR PetscLayoutSetBlockSize(*layout, 1);
156 const FeByPart &fe_by_part = numeredFiniteElementsPtr->get<Part_mi_tag>();
157 int nb_elems;
158 nb_elems = fe_by_part.count(rank);
159 CHKERR PetscLayoutSetLocalSize(*layout, nb_elems);
160 CHKERR PetscLayoutSetUp(*layout);
162}

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

217 {
218 return numeredColDofsPtr->begin();
219 }

◆ getNumeredColDofsByEntBegin()

auto 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 332 of file ProblemsMultiIndices.hpp.

332 {
333 return numeredColDofsPtr->get<Ent_mi_tag>().lower_bound(ent);
334 }

◆ getNumeredColDofsByEntEnd()

auto 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 338 of file ProblemsMultiIndices.hpp.

338 {
339 return numeredColDofsPtr->get<Ent_mi_tag>().upper_bound(ent);
340 }

◆ getNumeredColDofsByLocIdxBegin()

auto 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 276 of file ProblemsMultiIndices.hpp.

276 {
277 return numeredColDofsPtr->get<PetscLocalIdx_mi_tag>().lower_bound(locidx);
278 }

◆ getNumeredColDofsByLocIdxEnd()

auto 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 282 of file ProblemsMultiIndices.hpp.

282 {
283 return numeredColDofsPtr->get<PetscLocalIdx_mi_tag>().upper_bound(locidx);
284 }

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

223 {
224 return numeredColDofsPtr->end();
225 }

◆ getNumeredColDofsPtr()

auto & MoFEM::Problem::getNumeredColDofsPtr ( ) const

get access to numeredColDofsPtr storing DOFs on cols

Definition at line 87 of file ProblemsMultiIndices.hpp.

87{ return numeredColDofsPtr; }

◆ getNumeredFEsBegin()

auto MoFEM::Problem::getNumeredFEsBegin ( std::string  fe_name) const

Definition at line 159 of file ProblemsMultiIndices.hpp.

159 {
160 return numeredFiniteElementsPtr->get<FiniteElement_name_mi_tag>()
161 .lower_bound(fe_name);
162 }

◆ getNumeredFEsEnd()

auto MoFEM::Problem::getNumeredFEsEnd ( std::string  fe_name) const

Definition at line 164 of file ProblemsMultiIndices.hpp.

164 {
165 return numeredFiniteElementsPtr->get<FiniteElement_name_mi_tag>()
166 .upper_bound(fe_name);
167 }

◆ getNumeredFiniteElementsPtr()

const auto & MoFEM::Problem::getNumeredFiniteElementsPtr ( ) const

get access to reference for multi-index storing finite elements

Definition at line 92 of file ProblemsMultiIndices.hpp.

92 {
94 }

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

205 {
206 return numeredRowDofsPtr->begin();
207 }

◆ getNumeredRowDofsByEntBegin()

auto 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 320 of file ProblemsMultiIndices.hpp.

320 {
321 return numeredRowDofsPtr->get<Ent_mi_tag>().lower_bound(ent);
322 }

◆ getNumeredRowDofsByEntEnd()

auto 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 326 of file ProblemsMultiIndices.hpp.

326 {
327 return numeredRowDofsPtr->get<Ent_mi_tag>().upper_bound(ent);
328 }

◆ getNumeredRowDofsByLocIdxBegin()

auto 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 264 of file ProblemsMultiIndices.hpp.

264 {
265 return numeredRowDofsPtr->get<PetscLocalIdx_mi_tag>().lower_bound(locidx);
266 }

◆ getNumeredRowDofsByLocIdxEnd()

auto 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 270 of file ProblemsMultiIndices.hpp.

270 {
271 return numeredRowDofsPtr->get<PetscLocalIdx_mi_tag>().upper_bound(locidx);
272 }

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

211 {
212 return numeredRowDofsPtr->end();
213 }

◆ getNumeredRowDofsPtr()

auto & MoFEM::Problem::getNumeredRowDofsPtr ( ) const

get access to numeredRowDofsPtr storing DOFs on rows

Examples
eigen_elastic.cpp, and test_cache_on_entities.cpp.

Definition at line 82 of file ProblemsMultiIndices.hpp.

82{ return numeredRowDofsPtr; }

◆ 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 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 = numeredRowDofsPtr->get<PetscGlobalIdx_mi_tag>().find(idx);
85 if (dit != numeredRowDofsPtr->get<PetscGlobalIdx_mi_tag>().end())
86 dof_weak_ptr = *dit;
87 return dof_weak_ptr;
88}

◆ 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 101 of file ProblemsMultiIndices.cpp.

102 {
104 auto weak_dof_ptr = getRowDofsByPetscGlobalDofIdx(idx);
105 if (auto shared_dof_ptr = weak_dof_ptr.lock()) {
106 *dof_ptr = shared_dof_ptr.get();
107 } else {
108 if (bh == MF_EXIST)
109 SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_FOUND, "row dof <%d> not found", idx);
110 *dof_ptr = nullptr;
111 }
113}
MoFEMErrorCode getRowDofsByPetscGlobalDofIdx(DofIdx idx, const NumeredDofEntity **dof_ptr, MoFEMTypes bh=MF_EXIST) const
Get the Row Dofs By Petsc Global Dof Idx object.

◆ getRowDofsSequence()

auto & 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 522 of file ProblemsMultiIndices.hpp.

522{ return 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 111 of file ProblemsMultiIndices.hpp.

111 {
112 return subProblemData;
113 }
boost::shared_ptr< SubProblemData > subProblemData

Friends And Related Function Documentation

◆ operator<<

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

Definition at line 69 of file ProblemsMultiIndices.cpp.

69 {
70 os << "Problem id " << e.getId() << " name " << e.getName() << endl;
71 os << "FiniteElement id " << e.getBitFEId() << endl;
72 os << "BitRefLevel " << e.getBitRefLevel() << endl;
73 os << "BitRefLevelMask " << e.getBitRefLevelMask();
74 return os;
75}

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

◆ emptyFieldBlocks

EmptyFieldBlocks MoFEM::Problem::emptyFieldBlocks
mutableprivate

Definition at line 575 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 56 of file ProblemsMultiIndices.hpp.

◆ nbDofsCol

DofIdx MoFEM::Problem::nbDofsCol
mutable

Global number of DOFs in col.

Definition at line 66 of file ProblemsMultiIndices.hpp.

◆ nbDofsRow

DofIdx MoFEM::Problem::nbDofsRow
mutable

Global number of DOFs in row.

Examples
partition_mesh.cpp.

Definition at line 65 of file ProblemsMultiIndices.hpp.

◆ nbGhostDofsCol

DofIdx MoFEM::Problem::nbGhostDofsCol
mutable

Number of ghost DOFs in col.

Definition at line 70 of file ProblemsMultiIndices.hpp.

◆ nbGhostDofsRow

DofIdx MoFEM::Problem::nbGhostDofsRow
mutable

Number of ghost DOFs in row.

Definition at line 69 of file ProblemsMultiIndices.hpp.

◆ nbLocDofsCol

DofIdx MoFEM::Problem::nbLocDofsCol
mutable

Local number of DOFs in colIs.

Definition at line 68 of file ProblemsMultiIndices.hpp.

◆ nbLocDofsRow

DofIdx MoFEM::Problem::nbLocDofsRow
mutable

Local number of DOFs in row.

Definition at line 67 of file ProblemsMultiIndices.hpp.

◆ numeredColDofsPtr

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

store DOFs on columns for this problem

Definition at line 75 of file ProblemsMultiIndices.hpp.

◆ numeredFiniteElementsPtr

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

store finite elements

Definition at line 77 of file ProblemsMultiIndices.hpp.

◆ numeredRowDofsPtr

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

store DOFs on rows for this problem

Examples
cell_forces.cpp.

Definition at line 73 of file ProblemsMultiIndices.hpp.

◆ sequenceColDofContainer

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

Definition at line 573 of file ProblemsMultiIndices.hpp.

◆ sequenceRowDofContainer

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

Definition at line 572 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 105 of file ProblemsMultiIndices.hpp.

◆ tagBitFEId

BitFEId* MoFEM::Problem::tagBitFEId

IDs of finite elements in problem.

Definition at line 61 of file ProblemsMultiIndices.hpp.

◆ tagBitRefLevel

BitRefLevel* MoFEM::Problem::tagBitRefLevel

BitRef level of finite elements in problem.

Definition at line 62 of file ProblemsMultiIndices.hpp.

◆ tagBitRefLevelMask

BitRefLevel* MoFEM::Problem::tagBitRefLevelMask

BItRefMask of elements in problem.

Definition at line 63 of file ProblemsMultiIndices.hpp.

◆ tagId

BitProblemId* MoFEM::Problem::tagId

Unique problem ID.

Definition at line 58 of file ProblemsMultiIndices.hpp.

◆ tagName

const char* MoFEM::Problem::tagName

Problem name.

Definition at line 59 of file ProblemsMultiIndices.hpp.

◆ tagNameSize

int MoFEM::Problem::tagNameSize

Size of problem name.

Definition at line 60 of file ProblemsMultiIndices.hpp.


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