v0.9.0
Problems

Adding and managing problems. More...

Collaboration diagram for Problems:

Make elemnts multishared

MoFEMErrorCode MoFEM::CommInterface::resolveSharedFiniteElements (const Problem *problem_ptr, const std::string &fe_name, int verb=DEFAULT_VERBOSITY)
 resolve shared entities for finite elements in the problem More...
 
MoFEMErrorCode MoFEM::CommInterface::resolveSharedFiniteElements (const std::string &name, const std::string &fe_name, int verb=DEFAULT_VERBOSITY)
 resolve shared entities for finite elements in the problem More...
 

Build problems (DEPRECATED SHOULD NOT USE THIS)

DEPRECATED MoFEMErrorCode MoFEM::DeprecatedCoreInterface::get_problem_elements_layout (const std::string &name, const std::string &fe_name, PetscLayout *layout, int verb=-1)
 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...
 

Comm

DEPRECATED MoFEMErrorCode MoFEM::DeprecatedCoreInterface::resolve_shared_finite_elements (const Problem *problem_ptr, const std::string &fe_name, int verb=DEFAULT_VERBOSITY)
 resolve shared entities for finite elements in the problem More...
 
DEPRECATED MoFEMErrorCode MoFEM::DeprecatedCoreInterface::resolve_shared_finite_elements (const std::string &name, const std::string &fe_name, int verb=DEFAULT_VERBOSITY)
 resolve shared entities for finite elements in the problem\depreacted Use CommInterface More...
 

Problems

virtual MoFEMErrorCode MoFEM::CoreInterface::add_problem (const std::string &name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
 Add problem. More...
 
virtual MoFEMErrorCode MoFEM::CoreInterface::delete_problem (const std::string name)=0
 Delete problem. More...
 
virtual MoFEMErrorCode MoFEM::CoreInterface::modify_problem_add_finite_element (const std::string &name_problem, const std::string &fe_name)=0
 add finite element to problem, this add entities assigned to finite element to a particular problem More...
 
virtual MoFEMErrorCode MoFEM::CoreInterface::modify_problem_unset_finite_element (const std::string &name_problem, const std::string &fe_name)=0
 unset finite element from problem, this remove entities assigned to finite element to a particular problemNote: If problem is build, it need to be cleaned to make this effective More...
 
virtual MoFEMErrorCode MoFEM::CoreInterface::modify_problem_ref_level_add_bit (const std::string &name_problem, const BitRefLevel &bit)=0
 add ref level to problem More...
 
virtual MoFEMErrorCode MoFEM::CoreInterface::modify_problem_mask_ref_level_add_bit (const std::string &name_problem, const BitRefLevel &bit)=0
 set dof mask ref level for problem More...
 
virtual MoFEMErrorCode MoFEM::CoreInterface::modify_problem_ref_level_set_bit (const std::string &name_problem, const BitRefLevel &bit)=0
 set ref level for problem More...
 
virtual MoFEMErrorCode MoFEM::CoreInterface::modify_problem_mask_ref_level_set_bit (const std::string &name_problem, const BitRefLevel &bit)=0
 set dof mask ref level for problem More...
 
virtual MoFEMErrorCode MoFEM::CoreInterface::list_problem () const =0
 list problems More...
 
virtual MoFEMErrorCode MoFEM::CoreInterface::clear_problem (const std::string name, int verb=DEFAULT_VERBOSITY)=0
 clear problem More...
 
virtual MoFEMErrorCode MoFEM::CoreInterface::clear_problems (int verb=DEFAULT_VERBOSITY)=0
 clear problems More...
 
virtual MoFEMErrorCode MoFEM::CoreInterface::get_problem_finite_elements_entities (const std::string &name, const std::string &fe_name, const EntityHandle meshset)=0
 add finite elements to the meshset More...
 
virtual bool MoFEM::CoreInterface::check_problem (const std::string name)=0
 check if problem exist More...
 

Detailed Description

Adding and managing problems.

Function Documentation

◆ add_problem()

virtual MoFEMErrorCode MoFEM::CoreInterface::add_problem ( const std::string &  name,
enum MoFEMTypes  bh = MF_EXCL,
int  verb = DEFAULT_VERBOSITY 
)
pure virtual

◆ check_problem()

virtual bool MoFEM::CoreInterface::check_problem ( const std::string  name)
pure virtual

check if problem exist

Parameters
nameproblem name
Returns
true if problem is in database

Implemented in MoFEM::Core.

◆ clear_problem()

virtual MoFEMErrorCode MoFEM::CoreInterface::clear_problem ( const std::string  name,
int  verb = DEFAULT_VERBOSITY 
)
pure virtual

clear problem

Implemented in MoFEM::Core.

◆ clear_problems()

virtual MoFEMErrorCode MoFEM::CoreInterface::clear_problems ( int  verb = DEFAULT_VERBOSITY)
pure virtual

clear problems

Implemented in MoFEM::Core.

◆ delete_problem()

virtual MoFEMErrorCode MoFEM::CoreInterface::delete_problem ( const std::string  name)
pure virtual

Delete problem.

Note
add_file is a collective, should be executed on all processors. Otherwise could lead to deadlock.

Implemented in MoFEM::Core.

◆ get_problem_elements_layout()

MoFEMErrorCode MoFEM::DeprecatedCoreInterface::get_problem_elements_layout ( const std::string &  name,
const std::string &  fe_name,
PetscLayout *  layout,
int  verb = -1 
)

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

Deprecated:
use ProblemsManager
Parameters
nameproblem name
fe_namefinite elements
layoutlayout
verbverbosity level
Returns
error code

Definition at line 460 of file DeprecatedCoreInterface.cpp.

462  {
463  return getInterface<ProblemsManager>()->getProblemElementsLayout(
464  name, fe_name, layout);
465 }

◆ get_problem_finite_elements_entities()

virtual MoFEMErrorCode MoFEM::CoreInterface::get_problem_finite_elements_entities ( const std::string &  name,
const std::string &  fe_name,
const EntityHandle  meshset 
)
pure virtual

add finite elements to the meshset

Parameters
nameis problem name
fe_name
meshset

Implemented in MoFEM::Core.

◆ list_problem()

virtual MoFEMErrorCode MoFEM::CoreInterface::list_problem ( ) const
pure virtual

list problems

Implemented in MoFEM::Core.

◆ modify_problem_add_finite_element()

virtual MoFEMErrorCode MoFEM::CoreInterface::modify_problem_add_finite_element ( const std::string &  name_problem,
const std::string &  fe_name 
)
pure virtual

add finite element to problem, this add entities assigned to finite element to a particular problem

Note
add_file is a collective, should be executed on all processors. Otherwise could lead to deadlock.
Parameters
nameProblem name
nameFinite Element name

Implemented in MoFEM::Core.

Examples
build_problems.cpp, continuity_check_on_skeleton_3d.cpp, forces_and_sources_testing_edge_element.cpp, forces_and_sources_testing_flat_prism_element.cpp, forces_and_sources_testing_users_base.cpp, hcurl_check_approx_in_2d.cpp, hcurl_curl_operator.cpp, hcurl_divergence_operator_2d.cpp, mesh_insert_interface_atom.cpp, prism_elements_from_surface.cpp, prism_polynomial_approximation.cpp, quad_polynomial_approximation.cpp, and remove_entities_from_problem.cpp.

◆ modify_problem_mask_ref_level_add_bit()

virtual MoFEMErrorCode MoFEM::CoreInterface::modify_problem_mask_ref_level_add_bit ( const std::string &  name_problem,
const BitRefLevel bit 
)
pure virtual

set dof mask ref level for problem

Implemented in MoFEM::Core.

◆ modify_problem_mask_ref_level_set_bit()

virtual MoFEMErrorCode MoFEM::CoreInterface::modify_problem_mask_ref_level_set_bit ( const std::string &  name_problem,
const BitRefLevel bit 
)
pure virtual

set dof mask ref level for problem

Note
add_file is a collective, should be executed on all processors. Otherwise could lead to deadlock.

Implemented in MoFEM::Core.

◆ modify_problem_ref_level_add_bit()

virtual MoFEMErrorCode MoFEM::CoreInterface::modify_problem_ref_level_add_bit ( const std::string &  name_problem,
const BitRefLevel bit 
)
pure virtual

add ref level to problem

Note
add_file is a collective, should be executed on all processors. Otherwise could lead to deadlock.

if same finite element is solved using different level of refinements, than the level of refinement has to be specificied to problem in query

Parameters
nameProblem name
BitRefLevelbitLevel Example:
mField.modify_problem_add_finite_element("BEAM_BENDING_ON_MESH_REF1","ELASTIC");
mField.modify_problem_add_finite_element("BEAM_BENDING_ON_MESH_REF2","ELASTIC");
mField.modify_problem_ref_level_add_bit("BEAM_BENDING_ON_MESH_REF1",bit_level1);
mField.modify_problem_ref_level_add_bit("BEAM_BENDING_ON_MESH_REF2",bit_level2);
Two Problems exist and solved independently, both are elastic, but solved using different mesh refinement

Implemented in MoFEM::Core.

Examples
build_problems.cpp, continuity_check_on_skeleton_3d.cpp, forces_and_sources_testing_edge_element.cpp, forces_and_sources_testing_flat_prism_element.cpp, forces_and_sources_testing_users_base.cpp, hcurl_check_approx_in_2d.cpp, hcurl_curl_operator.cpp, hcurl_divergence_operator_2d.cpp, mesh_insert_interface_atom.cpp, prism_elements_from_surface.cpp, prism_polynomial_approximation.cpp, quad_polynomial_approximation.cpp, and remove_entities_from_problem.cpp.

◆ modify_problem_ref_level_set_bit()

virtual MoFEMErrorCode MoFEM::CoreInterface::modify_problem_ref_level_set_bit ( const std::string &  name_problem,
const BitRefLevel bit 
)
pure virtual

set ref level for problem

Note
add_file is a collective, should be executed on all processors. Otherwise could lead to deadlock.

if same finite element is solved using different level of refinements, than the level of refinement has to be specificied to problem in query

Parameters
nameProblem name
BitRefLevelbitLevel Example:
mField.modify_problem_add_finite_element("BEAM_BENDING_ON_MESH_REF1","ELASTIC");
mField.modify_problem_add_finite_element("BEAM_BENDING_ON_MESH_REF2","ELASTIC");
mField.modify_problem_ref_level_set_bit("BEAM_BENDING_ON_MESH_REF1",bit_level1);
mField.modify_problem_ref_level_set_bit("BEAM_BENDING_ON_MESH_REF2",bit_level2);
Two Problems exist and solved independently, both are elastic, but solved using different mesh refinement

Implemented in MoFEM::Core.

◆ modify_problem_unset_finite_element()

virtual MoFEMErrorCode MoFEM::CoreInterface::modify_problem_unset_finite_element ( const std::string &  name_problem,
const std::string &  fe_name 
)
pure virtual

unset finite element from problem, this remove entities assigned to finite element to a particular problemNote: If problem is build, it need to be cleaned to make this effective

Note
add_file is a collective, should be executed on all processors. Otherwise could lead to deadlock.
Parameters
nameProblem name
nameFinite Element name

Implemented in MoFEM::Core.

◆ resolve_shared_finite_elements() [1/2]

MoFEMErrorCode MoFEM::DeprecatedCoreInterface::resolve_shared_finite_elements ( const Problem problem_ptr,
const std::string &  fe_name,
int  verb = DEFAULT_VERBOSITY 
)

resolve shared entities for finite elements in the problem

Deprecated:
Use CommInterface
Parameters
problem_ptrproblem pointer
fe_namefinite element name
verbverbosity level
Returns
error code

This allows for tag reduction or tag exchange, f.e.

CHKERR m_field.resolve_shared_finite_elements(problem_ptr,"SHELL_ELEMENT");
Tag th;
CHKERR mField.get_moab().tag_get_handle("ADAPT_ORDER",th);
CHKERR ParallelComm* pcomm =
ParallelComm::get_pcomm(&mField.get_moab(),MYPCOMM_INDEX);
CHKERR pcomm->exchange_tags(th,prisms);

Definition at line 611 of file DeprecatedCoreInterface.cpp.

612  {
613  return getInterface<CommInterface>()->resolveSharedFiniteElements(
614  problem_ptr, fe_name, verb);
615 }

◆ resolve_shared_finite_elements() [2/2]

MoFEMErrorCode MoFEM::DeprecatedCoreInterface::resolve_shared_finite_elements ( const std::string &  name,
const std::string &  fe_name,
int  verb = DEFAULT_VERBOSITY 
)

resolve shared entities for finite elements in the problem\depreacted Use CommInterface

Parameters
nameproblem name
fe_namefinite element name
verbverbosity level
Returns
error code

This allows for tag reduction or tag exchange, f.e.

CHKERR m_field.resolve_shared_finite_elements(problem_ptr,"SHELL_ELEMENT");
Tag th;
CHKERR mField.get_moab().tag_get_handle("ADAPT_ORDER",th);
ParallelComm* pcomm =
ParallelComm::get_pcomm(&mField.get_moab(),MYPCOMM_INDEX);
// CHKERR pcomm->reduce_tags(th,MPI_SUM,prisms);
CHKERR pcomm->exchange_tags(th,prisms);

Definition at line 617 of file DeprecatedCoreInterface.cpp.

618  {
619  return getInterface<CommInterface>()->resolveSharedFiniteElements(
620  name, fe_name, verb);
621 }

◆ resolveSharedFiniteElements() [1/2]

MoFEMErrorCode MoFEM::CommInterface::resolveSharedFiniteElements ( const Problem problem_ptr,
const std::string &  fe_name,
int  verb = DEFAULT_VERBOSITY 
)

resolve shared entities for finite elements in the problem

Parameters
problem_ptrproblem pointer
fe_namefinite element name
verbverbosity level
Returns
error code

This allows for tag reduction or tag exchange, f.e.

CHKERR m_field.resolveSharedFiniteElements(problem_ptr,"SHELL_ELEMENT");
Tag th;
CHKERR mField.get_moab().tag_get_handle("ADAPT_ORDER",th);
CHKERR ParallelComm* pcomm =
ParallelComm::get_pcomm(&mField.get_moab(),MYPCOMM_INDEX);
CHKERR pcomm->exchange_tags(th,prisms);

Definition at line 229 of file CommInterface.cpp.

230  {
231  MoFEM::Interface &m_field = cOre;
233  ParallelComm *pcomm = ParallelComm::get_pcomm(
234  &m_field.get_moab(), m_field.get_basic_entity_data_ptr()->pcommID);
235  std::vector<int> shprocs(MAX_SHARING_PROCS, 0);
236  std::vector<EntityHandle> shhandles(MAX_SHARING_PROCS, 0);
237  Range ents;
238  Tag th_gid;
239  const int zero = 0;
240  CHKERR m_field.get_moab().tag_get_handle(GLOBAL_ID_TAG_NAME, 1,
241  MB_TYPE_INTEGER, th_gid,
242  MB_TAG_DENSE | MB_TAG_CREAT, &zero);
243  PetscLayout layout;
244  CHKERR problem_ptr->getNumberOfElementsByNameAndPart(m_field.get_comm(),
245  fe_name, &layout);
246  int gid, last_gid;
247  CHKERR PetscLayoutGetRange(layout, &gid, &last_gid);
248  CHKERR PetscLayoutDestroy(&layout);
249  for (_IT_NUMEREDFE_BY_NAME_FOR_LOOP_(problem_ptr, fe_name, fe_it)) {
250  EntityHandle ent = (*fe_it)->getEnt();
251  ents.insert(ent);
252  unsigned int part = (*fe_it)->getPart();
253  CHKERR m_field.get_moab().tag_set_data(pcomm->part_tag(), &ent, 1, &part);
254  if (part == pcomm->rank()) {
255  CHKERR m_field.get_moab().tag_set_data(th_gid, &ent, 1, &gid);
256  gid++;
257  }
258  shprocs.clear();
259  shhandles.clear();
260 
261  if (pcomm->size() > 1) {
262 
263  unsigned char pstatus = 0;
264  if (pcomm->rank() != part) {
265  pstatus = PSTATUS_NOT_OWNED;
266  pstatus |= PSTATUS_GHOST;
267  }
268 
269  if (pcomm->size() > 2) {
270  pstatus |= PSTATUS_SHARED;
271  pstatus |= PSTATUS_MULTISHARED;
272  } else {
273  pstatus |= PSTATUS_SHARED;
274  }
275 
276  size_t rrr = 0;
277  for (size_t rr = 0; rr < pcomm->size(); ++rr) {
278  if (rr != pcomm->rank()) {
279  shhandles[rrr] = ent;
280  shprocs[rrr] = rr;
281  ++rrr;
282  }
283  }
284  for (; rrr != pcomm->size(); ++rrr)
285  shprocs[rrr] = -1;
286 
287  if (pstatus & PSTATUS_SHARED) {
288  CHKERR m_field.get_moab().tag_set_data(pcomm->sharedp_tag(), &ent, 1,
289  &shprocs[0]);
290  CHKERR m_field.get_moab().tag_set_data(pcomm->sharedh_tag(), &ent, 1,
291  &shhandles[0]);
292  }
293 
294  if (pstatus & PSTATUS_MULTISHARED) {
295  CHKERR m_field.get_moab().tag_set_data(pcomm->sharedps_tag(), &ent, 1,
296  &shprocs[0]);
297  CHKERR m_field.get_moab().tag_set_data(pcomm->sharedhs_tag(), &ent, 1,
298  &shhandles[0]);
299  }
300  CHKERR m_field.get_moab().tag_set_data(pcomm->pstatus_tag(), &ent, 1,
301  &pstatus);
302  }
303  }
304  CHKERR pcomm->exchange_tags(th_gid, ents);
306 }
#define _IT_NUMEREDFE_BY_NAME_FOR_LOOP_(PROBLEMPTR, NAME, IT)
virtual moab::Interface & get_moab()=0
virtual boost::shared_ptr< BasicEntityData > & get_basic_entity_data_ptr()=0
Get pointer to basic entity data.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERR
Inline error check.
Definition: definitions.h:596
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407
virtual MPI_Comm & get_comm() const =0

◆ resolveSharedFiniteElements() [2/2]

MoFEMErrorCode MoFEM::CommInterface::resolveSharedFiniteElements ( const std::string &  name,
const std::string &  fe_name,
int  verb = DEFAULT_VERBOSITY 
)

resolve shared entities for finite elements in the problem

Parameters
nameproblem name
fe_namefinite element name
verbverbosity level
Returns
error code

This allows for tag reduction or tag exchange, f.e.

CHKERR m_field.resolveSharedFiniteElements(problem_ptr,"SHELL_ELEMENT");
Tag th;
CHKERR mField.get_moab().tag_get_handle("ADAPT_ORDER",th);
ParallelComm* pcomm =
ParallelComm::get_pcomm(&mField.get_moab(),MYPCOMM_INDEX);
// CHKERR pcomm->reduce_tags(th,MPI_SUM,prisms);
CHKERR pcomm->exchange_tags(th,prisms);

Definition at line 308 of file CommInterface.cpp.

309  {
310  MoFEM::Interface &m_field = cOre;
312  const Problem *problem_ptr;
313  CHKERR m_field.get_problem(name, &problem_ptr);
314  CHKERR resolveSharedFiniteElements(problem_ptr, fe_name, verb);
316 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
MoFEMErrorCode resolveSharedFiniteElements(const Problem *problem_ptr, const std::string &fe_name, int verb=DEFAULT_VERBOSITY)
resolve shared entities for finite elements in the problem
virtual MoFEMErrorCode get_problem(const std::string &problem_name, const Problem **problem_ptr) const =0
Get problem database (data structure)
#define CHKERR
Inline error check.
Definition: definitions.h:596
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407