v0.14.0
Public Member Functions | Public Attributes | List of all members
MoFEM::ISManager Struct Reference

Section manager is used to create indexes and sections. More...

#include <src/interfaces/ISManager.hpp>

Inheritance diagram for MoFEM::ISManager:
[legend]
Collaboration diagram for MoFEM::ISManager:
[legend]

Public Member Functions

MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const
 
 ISManager (const MoFEM::Core &core)
 
virtual ~ISManager ()=default
 Destructor. More...
 
MoFEMErrorCode sectionCreate (const std::string problem_name, PetscSection *s, const RowColData row_col=COL) const
 Create global selection. More...
 
SmartPetscObj< PetscSection > sectionCreate (const std::string problem_name, const RowColData row_col=COL) const
 Create global selection. More...
 
MoFEMErrorCode isCreateProblem (const std::string problem_name, RowColData rc, IS *is) const
 Create IS for problem. More...
 
MoFEMErrorCode isCreateProblem (const std::string problem_name, RowColData rc, SmartPetscObj< IS > &is) const
 Create IS for problem. More...
 
SmartPetscObj< IS > isCreateProblem (std::string problem_name, RowColData rc) const
 Create problem IS. More...
 
MoFEMErrorCode isCreateProblemOrder (const std::string problem_name, RowColData rc, int min_order, int max_order, IS *is) const
 create IS for given order range (collective) More...
 
MoFEMErrorCode isCreateProblemOrder (const std::string problem_name, RowColData rc, int min_order, int max_order, SmartPetscObj< IS > &is) const
 create IS for given order range (collective) More...
 
MoFEMErrorCode isCreateProblemFieldAndRank (const std::string problem_name, RowColData rc, const std::string field, int min_coeff_idx, int max_coeff_idx, IS *is, Range *ents=nullptr) const
 create IS for given problem, field and rank range (collective) More...
 
MoFEMErrorCode isCreateProblemFieldAndRank (const std::string problem_name, RowColData rc, const std::string field, int min_coeff_idx, int max_coeff_idx, SmartPetscObj< IS > &smart_is, Range *ents=nullptr) const
 IS for given problem, field and rank range (collective) More...
 
MoFEMErrorCode isCreateProblemFieldAndRankLocal (const std::string problem_name, RowColData rc, const std::string field, int min_coeff_idx, int max_coeff_idx, IS *is, Range *ents=nullptr) const
 create IS for given problem, field and rank range (collective) More...
 
MoFEMErrorCode isCreateProblemFieldAndRankLocal (const std::string problem_name, RowColData rc, const std::string field, int min_coeff_idx, int max_coeff_idx, SmartPetscObj< IS > &smart_is, Range *ents=nullptr) const
 IS for given problem, field and rank range (collective) More...
 
MoFEMErrorCode isCreateProblemFieldAndEntityType (const std::string problem_name, RowColData rc, const std::string field, EntityType low_type, EntityType hi_type, int min_coeff_idx, int max_coeff_idx, IS *is, Range *ents=nullptr) const
 create IS for given problem, field and type range (collective) More...
 
MoFEMErrorCode isCreateFromProblemFieldToOtherProblemField (const std::string x_problem, const std::string x_field_name, RowColData x_rc, const std::string y_problem, const std::string y_field_name, RowColData y_rc, std::vector< int > &idx, std::vector< int > &idy) const
 create IS for give two problems and field More...
 
MoFEMErrorCode isCreateFromProblemFieldToOtherProblemField (const std::string x_problem, const std::string x_field_name, RowColData x_rc, const std::string y_problem, const std::string y_field_name, RowColData y_rc, IS *ix, IS *iy) const
 create IS for give two problems and field More...
 
MoFEMErrorCode isCreateFromProblemToOtherProblem (const std::string x_problem, RowColData x_rc, const std::string y_problem, RowColData y_rc, std::vector< int > &idx, std::vector< int > &idy) const
 Create is from one problem to other problem. More...
 
MoFEMErrorCode isCreateFromProblemToOtherProblem (const std::string x_problem, RowColData x_rc, const std::string y_problem, RowColData y_rc, IS *ix, IS *iy) const
 Create is from one problem to other problem. More...
 
- Public Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (bool error_if_registration_failed=true)
 Register interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface reference to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface. More...
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface. More...
 
virtual ~UnknownInterface ()=default
 

Public Attributes

const MoFEM::InterfacecOre
 
bool dEbug
 

Additional Inherited Members

- Static Public Member Functions inherited from MoFEM::UnknownInterface
static MoFEMErrorCode getLibVersion (Version &version)
 Get library version. More...
 
static MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version)
 Get database major version. More...
 
static MoFEMErrorCode setFileVersion (moab::Interface &moab, Version version=Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD))
 Get database major version. More...
 
static MoFEMErrorCode getInterfaceVersion (Version &version)
 Get database major version. More...
 

Detailed Description

Section manager is used to create indexes and sections.

FIXME: ISManager is not properly tested by atom tests.

Examples
cell_forces.cpp, dm_build_partitioned_mesh.cpp, eigen_elastic.cpp, EshelbianPlasticity.cpp, free_surface.cpp, plastic.cpp, Remodeling.cpp, remove_entities_from_problem.cpp, remove_entities_from_problem_not_partitioned.cpp, seepage.cpp, shallow_wave.cpp, and thermo_elastic.cpp.

Definition at line 23 of file ISManager.hpp.

Constructor & Destructor Documentation

◆ ISManager()

MoFEM::ISManager::ISManager ( const MoFEM::Core core)

Definition at line 17 of file ISManager.cpp.

18  : cOre(const_cast<MoFEM::Core &>(core)), dEbug(false) {}

◆ ~ISManager()

virtual MoFEM::ISManager::~ISManager ( )
virtualdefault

Destructor.

Member Function Documentation

◆ isCreateProblem() [1/3]

MoFEMErrorCode MoFEM::ISManager::isCreateProblem ( const std::string  problem_name,
RowColData  rc,
IS *  is 
) const

Create IS for problem.

Parameters
problem_name
rc
is
Returns
MoFEMErrorCode

Definition at line 149 of file ISManager.cpp.

150  {
151  const MoFEM::Interface &m_field = cOre;
152  const Problem *problem_ptr;
154  CHKERR m_field.get_problem(problem_name, &problem_ptr);
155 
156  const int rank = m_field.get_comm_rank();
157 
158  decltype(problem_ptr->numeredRowDofsPtr) dofs_ptr;
159 
160  switch (rc) {
161  case ROW:
162  dofs_ptr = problem_ptr->numeredRowDofsPtr;
163  break;
164  case COL:
165  dofs_ptr = problem_ptr->numeredColDofsPtr;
166  break;
167  default:
168  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
169  }
170 
171  auto lo = dofs_ptr->get<Part_mi_tag>().lower_bound(rank);
172  auto hi = dofs_ptr->get<Part_mi_tag>().upper_bound(rank);
173  const int size = std::distance(lo, hi);
174 
175  int *id;
176  CHKERR PetscMalloc(size * sizeof(int), &id);
177  int *id_it = id;
178  for (; lo != hi; ++lo, ++id_it)
179  *id_it = (*lo)->getPetscGlobalDofIdx();
180  sort(id, &id[size]);
181 
182  CHKERR ISCreateGeneral(PETSC_COMM_WORLD, size, id, PETSC_OWN_POINTER, is);
183 
185 }

◆ isCreateProblem() [2/3]

MoFEMErrorCode MoFEM::ISManager::isCreateProblem ( const std::string  problem_name,
RowColData  rc,
SmartPetscObj< IS > &  is 
) const

Create IS for problem.

Parameters
problem_name
rc
is
Returns
MoFEMErrorCode

Definition at line 187 of file ISManager.cpp.

189  {
191  IS raw_is;
192  CHKERR isCreateProblem(problem_name, rc, &raw_is);
193  is = SmartPetscObj<IS>(raw_is);
195 }

◆ isCreateProblem() [3/3]

SmartPetscObj< IS > MoFEM::ISManager::isCreateProblem ( std::string  problem_name,
RowColData  rc 
) const

Create problem IS.

Parameters
problem_name
rc
Returns
SmartPetscObj<IS>

Definition at line 197 of file ISManager.cpp.

198  {
199  SmartPetscObj<IS> is;
200  CHK_THROW_MESSAGE(isCreateProblem(problem_name, rc, is), "IS not created");
201  return is;
202 }

◆ isCreateProblemOrder()

MoFEMErrorCode MoFEM::ISManager::isCreateProblemOrder ( const std::string  problem_name,
RowColData  rc,
int  min_order,
int  max_order,
SmartPetscObj< IS > &  is 
) const

create IS for given order range (collective)

Parameters
problemname
rcROW or COL
min_order
max_order
Return values
isout value

Definition at line 261 of file ISManager.cpp.

264  {
266  IS raw_is;
267  CHKERR isCreateProblemOrder(problem_name, rc, min_order, max_order, &raw_is);
268  is = SmartPetscObj<IS>(raw_is);
270 }

◆ query_interface()

MoFEMErrorCode MoFEM::ISManager::query_interface ( boost::typeindex::type_index  type_index,
UnknownInterface **  iface 
) const
virtual

Implements MoFEM::UnknownInterface.

Definition at line 10 of file ISManager.cpp.

11  {
13  *iface = const_cast<ISManager *>(this);
15 }

Member Data Documentation

◆ cOre

const MoFEM::Interface& MoFEM::ISManager::cOre

Definition at line 28 of file ISManager.hpp.

◆ dEbug

bool MoFEM::ISManager::dEbug

Definition at line 29 of file ISManager.hpp.


The documentation for this struct was generated from the following files:
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
MoFEM::CoreTmp< 0 >
Core (interface) class.
Definition: Core.hpp:82
CHK_THROW_MESSAGE
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
Definition: definitions.h:609
MoFEM::CoreInterface::get_comm_rank
virtual int get_comm_rank() const =0
MoFEM::CoreInterface::get_problem
virtual const Problem * get_problem(const std::string problem_name) const =0
Get the problem object.
MoFEM::DeprecatedCoreInterface
Deprecated interface functions.
Definition: DeprecatedCoreInterface.hpp:16
MoFEM::ISManager::isCreateProblem
MoFEMErrorCode isCreateProblem(const std::string problem_name, RowColData rc, IS *is) const
Create IS for problem.
Definition: ISManager.cpp:149
ROW
@ ROW
Definition: definitions.h:136
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
MoFEM::ISManager::cOre
const MoFEM::Interface & cOre
Definition: ISManager.hpp:28
COL
@ COL
Definition: definitions.h:136
MoFEM::ISManager::dEbug
bool dEbug
Definition: ISManager.hpp:29
MoFEM::ISManager::ISManager
ISManager(const MoFEM::Core &core)
Definition: ISManager.cpp:17
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
MoFEM::ISManager::isCreateProblemOrder
MoFEMErrorCode isCreateProblemOrder(const std::string problem_name, RowColData rc, int min_order, int max_order, IS *is) const
create IS for given order range (collective)
Definition: ISManager.cpp:204
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
MOFEM_NOT_IMPLEMENTED
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:32
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359