v0.8.23
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)
 
 ~ProblemsManager ()
 Destructor. More...
 
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 problemThis will use one of the mesh partitioning programs available from PETSc See http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatPartitioningType.html 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)Mesh is distributed, that means that each processor keeps only own part of the mesh and shared entities. More...
 
MoFEMErrorCode buildProblemOnDistributedMesh (Problem *problem_ptr, const bool square_matrix=true, int verb=VERBOSE)
 build problem data structures, assuming that mesh is distributed (collective)Mesh is distributed, that means that each processor keeps only own part of the mesh and shared entities. 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 elementsFunction which partition finite elements based on dofs partitioning.
In addition it sets information about local row and cols dofs at given element on partition. 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 problemIn layout is stored information how many elements is on each processor, for more information look int petsc documentation http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/IS/PetscLayoutCreate.html#PetscLayoutCreate 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 problemRemove DOFs from problem which are on entities on the given range and given field name. On the finite element level, DOFs can be still accessed however local PETSc indices and global PETSc indices are marked with the index -1. 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 ()
 
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.

Examples
build_problems.cpp, EshelbianPlasticity.cpp, forces_and_sources_testing_edge_element.cpp, forces_and_sources_testing_flat_prism_element.cpp, forces_and_sources_testing_users_base.cpp, Remodeling.cpp, and remove_entities_from_problem.cpp.

Definition at line 34 of file ProblemsManager.hpp.

Constructor & Destructor Documentation

◆ ProblemsManager()

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

Definition at line 74 of file ProblemsManager.cpp.

75  : cOre(const_cast<MoFEM::Core &>(core)),
76  buildProblemFromFields(PETSC_FALSE),
77  synchroniseProblemEntities(PETSC_FALSE) {
78  PetscLogEventRegister("ProblemsManager", 0, &MOFEM_EVENT_ProblemsManager);
79 }
PetscLogEvent MOFEM_EVENT_ProblemsManager
PetscBool synchroniseProblemEntities
DOFs in fields, not from DOFs on elements.

◆ ~ProblemsManager()

MoFEM::ProblemsManager::~ProblemsManager ( )

Destructor.

Definition at line 80 of file ProblemsManager.cpp.

80 {}

Member Function Documentation

◆ debugPartitionedProblem()

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

Definition at line 2290 of file ProblemsManager.cpp.

2290  {
2291  MoFEM::Interface &m_field = cOre;
2293  if (debug > 0) {
2294 
2295  typedef NumeredDofEntity_multiIndex::index<Idx_mi_tag>::type
2296  NumeredDofEntitysByIdx;
2297  NumeredDofEntitysByIdx::iterator dit, hi_dit;
2298  const NumeredDofEntitysByIdx *numered_dofs_ptr[] = {
2299  &(problem_ptr->numeredDofsRows->get<Idx_mi_tag>()),
2300  &(problem_ptr->numeredDofsCols->get<Idx_mi_tag>())};
2301 
2302  int *nbdof_ptr[] = {&problem_ptr->nbDofsRow, &problem_ptr->nbDofsCol};
2303  int *local_nbdof_ptr[] = {&problem_ptr->nbLocDofsRow,
2304  &problem_ptr->nbLocDofsCol};
2305 
2306  for (int ss = 0; ss < 2; ss++) {
2307 
2308  dit = numered_dofs_ptr[ss]->begin();
2309  hi_dit = numered_dofs_ptr[ss]->end();
2310  for (; dit != hi_dit; dit++) {
2311  if ((*dit)->getPart() == (unsigned int)m_field.get_comm_rank()) {
2312  if ((*dit)->getPetscLocalDofIdx() < 0) {
2313  std::ostringstream zz;
2314  zz << "rank " << m_field.get_comm_rank() << " " << **dit;
2315  SETERRQ2(PETSC_COMM_SELF, MOFEM_IMPOSIBLE_CASE,
2316  "local dof index for %d (0-row, 1-col) not set, i.e. has "
2317  "negative value\n %s",
2318  ss, zz.str().c_str());
2319  }
2320  if ((*dit)->getPetscLocalDofIdx() >= *local_nbdof_ptr[ss]) {
2321  std::ostringstream zz;
2322  zz << "rank " << m_field.get_comm_rank() << " " << **dit;
2323  SETERRQ2(PETSC_COMM_SELF, MOFEM_IMPOSIBLE_CASE,
2324  "local dofs for %d (0-row, 1-col) out of range\n %s", ss,
2325  zz.str().c_str());
2326  }
2327  } else {
2328  if ((*dit)->getPetscGlobalDofIdx() < 0) {
2329  std::ostringstream zz;
2330  zz << "rank " << m_field.get_comm_rank() << " "
2331  << dit->get()->getBitRefLevel() << " " << **dit;
2332  SETERRQ2(PETSC_COMM_SELF, MOFEM_IMPOSIBLE_CASE,
2333  "global dof index for %d (0-row, 1-col) row not set, i.e. "
2334  "has negative value\n %s",
2335  ss, zz.str().c_str());
2336  }
2337  if ((*dit)->getPetscGlobalDofIdx() >= *nbdof_ptr[ss]) {
2338  std::ostringstream zz;
2339  zz << "rank " << m_field.get_comm_rank() << " nb_dofs "
2340  << *nbdof_ptr[ss] << " " << **dit;
2341  SETERRQ2(PETSC_COMM_SELF, MOFEM_IMPOSIBLE_CASE,
2342  "global dofs for %d (0-row, 1-col) out of range\n %s", ss,
2343  zz.str().c_str());
2344  }
2345  }
2346  }
2347  }
2348  }
2350 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:500
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:507
virtual int get_comm_rank() const =0
static const bool debug

◆ getOptions()

MoFEMErrorCode MoFEM::ProblemsManager::getOptions ( )

Definition at line 82 of file ProblemsManager.cpp.

82  {
83  MoFEM::Interface &m_field = cOre;
85  CHKERR PetscOptionsBegin(m_field.get_comm(), "", "Problem manager", "none");
86  {
87  CHKERR PetscOptionsBool(
88  "-problem_build_from_fields",
89  "Add DOFs to problem directly from fields not through DOFs on elements",
91  }
92  ierr = PetscOptionsEnd();
93  CHKERRG(ierr);
95 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:500
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:543
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:507
#define CHKERR
Inline error check.
Definition: definitions.h:595
virtual MPI_Comm & get_comm() const =0

◆ printPartitionedProblem()

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

Definition at line 2246 of file ProblemsManager.cpp.

2246  {
2247  MoFEM::Interface &m_field = cOre;
2249  if (verb > 0) {
2250  std::ostringstream ss;
2251  ss << "partition_problem: rank = " << m_field.get_comm_rank()
2252  << " FEs row ghost dofs " << *problem_ptr << " Nb. local dof "
2253  << problem_ptr->getNbLocalDofsRow() << " nb global row dofs "
2254  << problem_ptr->getNbDofsRow() << std::endl;
2255  ss << "partition_problem: rank = " << m_field.get_comm_rank()
2256  << " FEs col ghost dofs " << *problem_ptr << " Nb. local dof "
2257  << problem_ptr->getNbLocalDofsCol() << " nb global col dofs "
2258  << problem_ptr->getNbDofsCol() << std::endl;
2259  PetscSynchronizedPrintf(m_field.get_comm(), ss.str().c_str());
2260  PetscSynchronizedFlush(m_field.get_comm(), PETSC_STDOUT);
2261  }
2262  if (verb > 1) {
2263  // FIXME mess if printed on more than one processors
2264  // std::ostringstream ss;
2265  std::cout << "rank = " << m_field.get_comm_rank() << " FEs row dofs "
2266  << *problem_ptr << " Nb. row dof " << problem_ptr->getNbDofsRow()
2267  << " Nb. local dof " << problem_ptr->getNbLocalDofsRow()
2268  << std::endl;
2269  NumeredDofEntity_multiIndex::iterator miit_dd_row =
2270  problem_ptr->numeredDofsRows->begin();
2271  for (; miit_dd_row != problem_ptr->numeredDofsRows->end(); miit_dd_row++) {
2272  std::cout << **miit_dd_row << std::endl;
2273  }
2274  std::cout << "rank = " << m_field.get_comm_rank() << " FEs col dofs "
2275  << *problem_ptr << " Nb. col dof " << problem_ptr->getNbDofsCol()
2276  << " Nb. local dof " << problem_ptr->getNbLocalDofsCol()
2277  << std::endl;
2278  NumeredDofEntity_multiIndex::iterator miit_dd_col =
2279  problem_ptr->numeredDofsCols->begin();
2280  for (; miit_dd_col != problem_ptr->numeredDofsCols->end(); miit_dd_col++) {
2281  std::cout << **miit_dd_col << std::endl;
2282  }
2283  // PetscSynchronizedPrintf(comm,ss.str().c_str());
2284  // PetscSynchronizedFlush(comm,PETSC_STDOUT);
2285  }
2287 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:500
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:507
virtual int get_comm_rank() const =0
virtual MPI_Comm & get_comm() const =0

◆ query_interface()

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

Implements MoFEM::UnknownInterface.

Definition at line 62 of file ProblemsManager.cpp.

63  {
65  *iface = NULL;
66  if (uuid == IDD_MOFEMProblemsManager) {
67  *iface = const_cast<ProblemsManager *>(this);
69  }
70  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "unknown interface");
72 }
static const MOFEMuuid IDD_MOFEMProblemsManager
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:500
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:507

Member Data Documentation

◆ buildProblemFromFields

PetscBool MoFEM::ProblemsManager::buildProblemFromFields

If set to true, problem is build from

Definition at line 47 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 330 of file ProblemsManager.hpp.

◆ synchroniseProblemEntities

PetscBool MoFEM::ProblemsManager::synchroniseProblemEntities

DOFs in fields, not from DOFs on elements.

Definition at line 50 of file ProblemsManager.hpp.


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