v0.10.0
Public Member Functions | Public Attributes | Private Attributes | List of all members
MoFEM::ProblemsManager Struct Reference

Problem manager is used to build and partition problems. More...

#include <src/interfaces/ProblemsManager.hpp>

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

Public Member Functions

MoFEMErrorCode query_interface (const MOFEMuuid &uuid, UnknownInterface **iface) const
 
 ProblemsManager (const MoFEM::Core &core)
 
virtual ~ProblemsManager ()=default
 
MoFEMErrorCode getOptions ()
 
MoFEMErrorCode partitionMesh (const Range &ents, const int dim, const int adj_dim, const int n_parts, Tag *th_vertex_weights=nullptr, Tag *th_edge_weights=nullptr, Tag *th_part_weights=nullptr, int verb=VERBOSE, const bool debug=false)
 Set partition tag to each finite element in the problem. More...
 
MoFEMErrorCode buildProblem (const std::string name, const bool square_matrix, int verb=VERBOSE)
 build problem data structures More...
 
MoFEMErrorCode buildProblem (Problem *problem_ptr, const bool square_matrix, int verb=VERBOSE)
 build problem data structures More...
 
MoFEMErrorCode buildProblemOnDistributedMesh (const std::string name, const bool square_matrix, int verb=VERBOSE)
 build problem data structures, assuming that mesh is distributed (collective) More...
 
MoFEMErrorCode buildProblemOnDistributedMesh (Problem *problem_ptr, const bool square_matrix=true, int verb=VERBOSE)
 build problem data structures, assuming that mesh is distributed (collective) More...
 
MoFEMErrorCode buildSubProblem (const std::string out_name, const std::vector< std::string > &fields_row, const std::vector< std::string > &fields_col, const std::string main_problem, const bool square_matrix=true, const map< std::string, std::pair< EntityType, EntityType >> *entityMapRow=nullptr, const map< std::string, std::pair< EntityType, EntityType >> *entityMapCol=nullptr, int verb=VERBOSE)
 build sub problem More...
 
MoFEMErrorCode buildCompsedProblem (const std::string out_name, const std::vector< std::string > add_row_problems, const std::vector< std::string > add_col_problems, const bool square_matrix=true, int verb=1)
 build composite problem More...
 
MoFEMErrorCode inheritPartition (const std::string name, const std::string problem_for_rows, bool copy_rows, const std::string problem_for_cols, bool copy_cols, int verb=VERBOSE)
 build indexing and partition problem inheriting indexing and partitioning from two other problems More...
 
MoFEMErrorCode partitionSimpleProblem (const std::string name, int verb=VERBOSE)
 partition problem dofs More...
 
MoFEMErrorCode partitionProblem (const std::string name, int verb=VERBOSE)
 partition problem dofs (collective) More...
 
MoFEMErrorCode printPartitionedProblem (const Problem *problem_ptr, int verb=VERBOSE)
 
MoFEMErrorCode debugPartitionedProblem (const Problem *problem_ptr, int verb=VERBOSE)
 
MoFEMErrorCode partitionFiniteElements (const std::string name, bool part_from_moab=false, int low_proc=-1, int hi_proc=-1, int verb=VERBOSE)
 partition finite elements More...
 
MoFEMErrorCode partitionGhostDofs (const std::string name, int verb=VERBOSE)
 determine ghost nodes More...
 
MoFEMErrorCode partitionGhostDofsOnDistributedMesh (const std::string name, int verb=VERBOSE)
 determine ghost nodes on distributed meshes More...
 
MoFEMErrorCode getFEMeshset (const std::string prb_name, const std::string fe_name, EntityHandle *meshset) const
 create add entities of finite element in the problem More...
 
MoFEMErrorCode getProblemElementsLayout (const std::string name, const std::string fe_name, PetscLayout *layout) const
 Get layout of elements in the problem. More...
 
MoFEMErrorCode removeDofsOnEntities (const std::string problem_name, const std::string field_name, const Range ents, const int lo_coeff=0, const int hi_coeff=MAX_DOFS_ON_ENTITY, int verb=VERBOSE, const bool debug=false)
 Remove DOFs from problem. More...
 
MoFEMErrorCode markDofs (const std::string problem_name, RowColData rc, const Range ents, std::vector< bool > &marker)
 Create vector with marked indices. More...
 
- Public Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (const MOFEMuuid &uuid, bool error_if_registration_failed=true)
 Register interface. More...
 
template<class IFACE , bool VERIFY = false>
MoFEMErrorCode getInterface (const MOFEMuuid &uuid, IFACE *&iface) const
 Get interface by uuid and return reference to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface refernce 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
 
virtual MoFEMErrorCode getLibVersion (Version &version) const
 Get library version. More...
 
virtual const MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version) const
 Get database major version. More...
 
virtual MoFEMErrorCode getInterfaceVersion (Version &version) const
 Get database major version. More...
 
template<>
MoFEMErrorCode getInterface (const MOFEMuuid &uuid, UnknownInterface *&iface) const
 

Public Attributes

MoFEM::CorecOre
 
PetscBool buildProblemFromFields
 
PetscBool synchroniseProblemEntities
 DOFs in fields, not from DOFs on elements. More...
 

Private Attributes

PetscLogEvent MOFEM_EVENT_ProblemsManager
 

Additional Inherited Members

- Protected Member Functions inherited from MoFEM::UnknownInterface
boost::typeindex::type_index getClassIdx (const MOFEMuuid &uid) const
 Get type name for interface Id. More...
 
MOFEMuuid getUId (const boost::typeindex::type_index &class_idx) const
 Get interface Id for class name. More...
 

Detailed Description

Problem manager is used to build and partition problems.

Definition at line 34 of file ProblemsManager.hpp.

Constructor & Destructor Documentation

◆ ProblemsManager()

MoFEM::ProblemsManager::ProblemsManager ( const MoFEM::Core core)

Definition at line 82 of file ProblemsManager.cpp.

83  : cOre(const_cast<MoFEM::Core &>(core)),
84  buildProblemFromFields(PETSC_FALSE),
85  synchroniseProblemEntities(PETSC_FALSE) {
86  PetscLogEventRegister("ProblemsManager", 0, &MOFEM_EVENT_ProblemsManager);
87 }
Core (interface) class.
Definition: Core.hpp:77
PetscLogEvent MOFEM_EVENT_ProblemsManager
PetscBool synchroniseProblemEntities
DOFs in fields, not from DOFs on elements.

◆ ~ProblemsManager()

virtual MoFEM::ProblemsManager::~ProblemsManager ( )
virtualdefault

Member Function Documentation

◆ debugPartitionedProblem()

MoFEMErrorCode MoFEM::ProblemsManager::debugPartitionedProblem ( const Problem problem_ptr,
int  verb = VERBOSE 
)

Definition at line 2354 of file ProblemsManager.cpp.

2354  {
2355  MoFEM::Interface &m_field = cOre;
2357  if (debug > 0) {
2358 
2360  NumeredDofEntitysByIdx;
2361  NumeredDofEntitysByIdx::iterator dit, hi_dit;
2362  const NumeredDofEntitysByIdx *numered_dofs_ptr[] = {
2363  &(problem_ptr->numeredRowDofsPtr->get<Idx_mi_tag>()),
2364  &(problem_ptr->numeredColDofsPtr->get<Idx_mi_tag>())};
2365 
2366  int *nbdof_ptr[] = {&problem_ptr->nbDofsRow, &problem_ptr->nbDofsCol};
2367  int *local_nbdof_ptr[] = {&problem_ptr->nbLocDofsRow,
2368  &problem_ptr->nbLocDofsCol};
2369 
2370  for (int ss = 0; ss < 2; ss++) {
2371 
2372  dit = numered_dofs_ptr[ss]->begin();
2373  hi_dit = numered_dofs_ptr[ss]->end();
2374  for (; dit != hi_dit; dit++) {
2375  if ((*dit)->getPart() == (unsigned int)m_field.get_comm_rank()) {
2376  if ((*dit)->getPetscLocalDofIdx() < 0) {
2377  std::ostringstream zz;
2378  zz << "rank " << m_field.get_comm_rank() << " " << **dit;
2379  SETERRQ2(PETSC_COMM_SELF, MOFEM_IMPOSIBLE_CASE,
2380  "local dof index for %d (0-row, 1-col) not set, i.e. has "
2381  "negative value\n %s",
2382  ss, zz.str().c_str());
2383  }
2384  if ((*dit)->getPetscLocalDofIdx() >= *local_nbdof_ptr[ss]) {
2385  std::ostringstream zz;
2386  zz << "rank " << m_field.get_comm_rank() << " " << **dit;
2387  SETERRQ2(PETSC_COMM_SELF, MOFEM_IMPOSIBLE_CASE,
2388  "local dofs for %d (0-row, 1-col) out of range\n %s", ss,
2389  zz.str().c_str());
2390  }
2391  } else {
2392  if ((*dit)->getPetscGlobalDofIdx() < 0) {
2393  std::ostringstream zz;
2394  zz << "rank " << m_field.get_comm_rank() << " "
2395  << dit->get()->getBitRefLevel() << " " << **dit;
2396  SETERRQ2(PETSC_COMM_SELF, MOFEM_IMPOSIBLE_CASE,
2397  "global dof index for %d (0-row, 1-col) row not set, i.e. "
2398  "has negative value\n %s",
2399  ss, zz.str().c_str());
2400  }
2401  if ((*dit)->getPetscGlobalDofIdx() >= *nbdof_ptr[ss]) {
2402  std::ostringstream zz;
2403  zz << "rank " << m_field.get_comm_rank() << " nb_dofs "
2404  << *nbdof_ptr[ss] << " " << **dit;
2405  SETERRQ2(PETSC_COMM_SELF, MOFEM_IMPOSIBLE_CASE,
2406  "global dofs for %d (0-row, 1-col) out of range\n %s", ss,
2407  zz.str().c_str());
2408  }
2409  }
2410  }
2411  }
2412  }
2414 }
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:516
@ MOFEM_IMPOSIBLE_CASE
Definition: definitions.h:127
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:509
static const bool debug
virtual int get_comm_rank() const =0
Deprecated interface functions.

◆ getOptions()

MoFEMErrorCode MoFEM::ProblemsManager::getOptions ( )

Definition at line 89 of file ProblemsManager.cpp.

89  {
90  MoFEM::Interface &m_field = cOre;
92  CHKERR PetscOptionsBegin(m_field.get_comm(), "", "Problem manager", "none");
93  {
94  CHKERR PetscOptionsBool(
95  "-problem_build_from_fields",
96  "Add DOFs to problem directly from fields not through DOFs on elements",
98  }
99  ierr = PetscOptionsEnd();
100  CHKERRG(ierr);
102 }
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:552
#define CHKERR
Inline error check.
Definition: definitions.h:604
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:87
virtual MPI_Comm & get_comm() const =0

◆ markDofs()

MoFEMErrorCode MoFEM::ProblemsManager::markDofs ( const std::string  problem_name,
RowColData  rc,
const Range  ents,
std::vector< bool > &  marker 
)

Create vector with marked indices.

Vector with local DOFs marked by entities

Parameters
problem_name
row
ents
marker
Returns
MoFEMErrorCode

Definition at line 3078 of file ProblemsManager.cpp.

3080  {
3081 
3082  Interface &m_field = cOre;
3083  const Problem *problem_ptr;
3085  CHKERR m_field.get_problem(problem_name, &problem_ptr);
3086  boost::shared_ptr<NumeredDofEntity_multiIndex> dofs;
3087  switch (rc) {
3088  case ROW:
3089  dofs = problem_ptr->getNumeredRowDofsPtr();
3090  break;
3091  case COL:
3092  dofs = problem_ptr->getNumeredColDofsPtr();
3093  default:
3094  SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSIBLE_CASE, "Should be row or column");
3095  }
3096  marker.resize(dofs->size());
3097  std::fill(marker.begin(), marker.end(), false);
3098  for (auto p = ents.pair_begin(); p != ents.pair_end(); ++p) {
3099  auto lo = dofs->get<Ent_mi_tag>().lower_bound(p->first);
3100  auto hi = dofs->get<Ent_mi_tag>().upper_bound(p->second);
3101  for (; lo != hi; ++lo)
3102  marker[(*lo)->getPetscLocalDofIdx()] = true;
3103  }
3105 }
static Index< 'p', 3 > p
#define ProblemManagerFunctionBegin
@ COL
Definition: definitions.h:192
@ ROW
Definition: definitions.h:192
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1943

◆ printPartitionedProblem()

MoFEMErrorCode MoFEM::ProblemsManager::printPartitionedProblem ( const Problem problem_ptr,
int  verb = VERBOSE 
)

Definition at line 2335 of file ProblemsManager.cpp.

2335  {
2336  MoFEM::Interface &m_field = cOre;
2338 
2339  if (verb > QUIET) {
2340 
2341  MOFEM_LOG("SYNC", Sev::inform)
2342  << problem_ptr->getName() << " Nb. local dof "
2343  << problem_ptr->getNbLocalDofsRow() << " by "
2344  << problem_ptr->getNbLocalDofsCol() << " nb global dofs "
2345  << problem_ptr->getNbDofsRow() << " by " << problem_ptr->getNbDofsCol();
2346 
2347  MOFEM_LOG_SYNCHRONISE(m_field.get_comm())
2348  }
2349 
2351 }
#define MOFEM_LOG_SYNCHRONISE(comm)
Synchronise "SYNC" channel.
Definition: LogManager.hpp:349
@ QUIET
Definition: definitions.h:277
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:312

◆ query_interface()

MoFEMErrorCode MoFEM::ProblemsManager::query_interface ( const MOFEMuuid uuid,
UnknownInterface **  iface 
) const
virtual

Implements MoFEM::UnknownInterface.

Definition at line 70 of file ProblemsManager.cpp.

71  {
73  *iface = NULL;
74  if (uuid == IDD_MOFEMProblemsManager) {
75  *iface = const_cast<ProblemsManager *>(this);
77  }
78  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "unknown interface");
80 }
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:123
static const MOFEMuuid IDD_MOFEMProblemsManager
ProblemsManager(const MoFEM::Core &core)

Member Data Documentation

◆ buildProblemFromFields

PetscBool MoFEM::ProblemsManager::buildProblemFromFields

If set to true, problem is build from

Definition at line 43 of file ProblemsManager.hpp.

◆ cOre

MoFEM::Core& MoFEM::ProblemsManager::cOre

Definition at line 39 of file ProblemsManager.hpp.

◆ MOFEM_EVENT_ProblemsManager

PetscLogEvent MoFEM::ProblemsManager::MOFEM_EVENT_ProblemsManager
private

Definition at line 341 of file ProblemsManager.hpp.

◆ synchroniseProblemEntities

PetscBool MoFEM::ProblemsManager::synchroniseProblemEntities

DOFs in fields, not from DOFs on elements.

Definition at line 46 of file ProblemsManager.hpp.


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