v0.15.5
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | List of all members
MoFEM::MeshsetsManager Struct Reference

Interface for managing meshsets containing materials and boundary conditions. More...

#include "src/interfaces/MeshsetsManager.hpp"

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

Public Member Functions

MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const
 Query interface for MeshsetsManager.
 
 MeshsetsManager (const MoFEM::Core &core)
 Constructor for MeshsetsManager.
 
virtual ~MeshsetsManager ()=default
 
MoFEMErrorCode getTags (int verb=-1)
 Get tag handles used on meshsets.
 
Tag get_nsTag () const
 get tag handle used to store "id" of NODESET
 
Tag get_ssTag () const
 get tag handle used to store "id" of SIDESET
 
Tag get_nsTag_data () const
 get tag handle used to store boundary data on NODESET
 
Tag get_ssTag_data () const
 get tag handle used to store boundary data on SIDESET
 
Tag get_bhTag () const
 get tag handle used to store "id" of BLOCKSET
 
Tag get_bhTag_header () const
 get tag handle used to store of block set header (Used by Cubit)
 
MeshsetsManagerget_meshsets_manager_ptr ()
 return pointer to meshset manager
 
const MeshsetsManagerget_meshsets_manager_ptr () const
 return pointer to meshset manager
 
MoFEMErrorCode clearMap ()
 Clear the multi-index container.
 
MoFEMErrorCode initialiseDatabaseFromMesh (int verb=DEFAULT_VERBOSITY)
 Initialize container from mesh data.
 
MoFEMErrorCode readMeshsets (int verb=DEFAULT_VERBOSITY)
 Read meshsets from mesh database.
 
MoFEMErrorCode broadcastMeshsets (int verb=DEFAULT_VERBOSITY)
 Broadcast meshsets across MPI processes.
 
template<class CUBIT_BC_DATA_TYPE >
MoFEMErrorCode printBcSet (CUBIT_BC_DATA_TYPE &data, unsigned long int type) const
 
MoFEMErrorCode printDisplacementSet () const
 Print meshsets with displacement boundary conditions.
 
MoFEMErrorCode printPressureSet () const
 Print meshsets with pressure boundary conditions.
 
MoFEMErrorCode printForceSet () const
 Print meshsets with force boundary conditions.
 
MoFEMErrorCode printTemperatureSet () const
 Print meshsets with temperature boundary conditions.
 
MoFEMErrorCode printHeatFluxSet () const
 Print meshsets with heat flux boundary conditions.
 
MoFEMErrorCode printMaterialsSet () const
 Print meshsets with material properties.
 
CubitMeshSet_multiIndexgetMeshsetsMultindex ()
 
CubitMeshSet_multiIndex::iterator getBegin () const
 get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
CubitMeshSet_multiIndex::iterator getEnd () const
 get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
CubitMeshsetByType::iterator getBegin (const unsigned int cubit_bc_type) const
 get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
CubitMeshsetByType::iterator getEnd (const unsigned int cubit_bc_type) const
 get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
CubitMeshsetByMask::iterator getBySetTypeBegin (const unsigned int cubit_bc_type) const
 get end iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
CubitMeshsetByMask::iterator getBySetTypeEnd (const unsigned int cubit_bc_type) const
 get end iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
CubitMeshsetByName::iterator getBegin (const std::string &name) const
 get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
CubitMeshsetByName::iterator getEnd (const std::string &name) const
 get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
bool checkMeshset (const int ms_id, const CubitBCType cubit_bc_type) const
 Check for CUBIT meshset by ID and type.
 
bool checkMeshset (const string name, int *const number_of_meshsets_ptr=NULL) const
 Check if meshset with given name exists.
 
MoFEMErrorCode addMeshset (const CubitBCType cubit_bc_type, const int ms_id, const std::string name="")
 Add CUBIT meshset to manager.
 
MoFEMErrorCode addEntitiesToMeshset (const CubitBCType cubit_bc_type, const int ms_id, const Range &ents)
 Add entities to CUBIT meshset.
 
MoFEMErrorCode addEntitiesToMeshset (const CubitBCType cubit_bc_type, const int ms_id, const EntityHandle *ents, const int nb_ents)
 Add entities to CUBIT meshset (array version)
 
MoFEMErrorCode setAttributes (const CubitBCType cubit_bc_type, const int ms_id, const std::vector< double > &attributes, const std::string name="")
 Set attributes for CUBIT meshset.
 
DEPRECATED auto setAtributes (const CubitBCType cubit_bc_type, const int ms_id, const std::vector< double > &attributes, const std::string name="")
 
MoFEMErrorCode setAttributesByDataStructure (const CubitBCType cubit_bc_type, const int ms_id, const GenericAttributeData &data, const std::string name="")
 Set attributes using data structure.
 
DEPRECATED auto setAtributesByDataStructure (const CubitBCType cubit_bc_type, const int ms_id, const GenericAttributeData &data, const std::string name="")
 
MoFEMErrorCode setBcData (const CubitBCType cubit_bc_type, const int ms_id, const GenericCubitBcData &data)
 Set boundary condition data for meshset.
 
MoFEMErrorCode deleteMeshset (const CubitBCType cubit_bc_type, const int ms_id, const MoFEMTypes bh=MF_EXIST)
 delete cubit meshset
 
MoFEMErrorCode getCubitMeshsetPtr (const int ms_id, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr) const
 get cubit meshset
 
const CubitMeshSetsgetCubitMeshsetPtr (const int ms_id, const CubitBCType cubit_bc_type) const
 get cubit meshset
 
MoFEMErrorCode getCubitMeshsetPtr (const CubitBCType cubit_bc_type, std::vector< const CubitMeshSets * > &vec_ptr) const
 Get vector of pointer by bc type.
 
std::vector< const CubitMeshSets * > getCubitMeshsetPtr (const CubitBCType cubit_bc_type) const
 Get vector of pointer by bc type.
 
MoFEMErrorCode getCubitMeshsetPtr (const string name, const CubitMeshSets **cubit_meshset_ptr) const
 get cubit meshset
 
MoFEMErrorCode getCubitMeshsetPtr (const std::regex reg_exp_name, std::vector< const CubitMeshSets * > &vec_ptr) const
 Get vector of pointer to blocksets with name satisfying regular expression.
 
std::vector< const CubitMeshSets * > getCubitMeshsetPtr (const std::regex reg_exp_name) const
 Get vector of pointer to blocksets with name satisfying regular expression.
 
MoFEMErrorCode getEntitiesByDimension (const int ms_id, const unsigned int cubit_bc_type, const int dimension, Range &entities, const bool recursive=true) const
 get entities from CUBIT/meshset of a particular entity dimension
 
MoFEMErrorCode getEntitiesByDimension (const int ms_id, const unsigned int cubit_bc_type, Range &entities, const bool recursive=true) const
 get entities related to CUBIT/meshset,
 
MoFEMErrorCode getMeshset (const int ms_id, const unsigned int cubit_bc_type, EntityHandle &meshset) const
 get meshset from CUBIT Id and CUBIT type
 
bool checkIfMeshsetContainsEntities (const int ms_id, const unsigned int cubit_bc_type, const EntityHandle *entities, int num_entities, const int operation_type=moab::Interface::INTERSECT)
 Check if meshset constains entities.
 
MoFEMErrorCode getMeshsetsByType (const unsigned int cubit_bc_type, Range &meshsets) const
 get all CUBIT meshsets by CUBIT type
 
MoFEMErrorCode setMeshsetFromFile (const string file_name, const bool clean_file_options=true)
 add blocksets reading config file
 
MoFEMErrorCode setMeshsetFromFile ()
 Load meshset configuration from command line specified file.
 
MoFEMErrorCode saveMeshsetToFile (const int ms_id, const unsigned int cubit_bc_type, const std::string file_name="out_meshset.vtk", const std::string file_type="VTK", const std::string options="") const
 save cubit meshset entities on the moab mesh
 
MoFEMErrorCode saveMeshsetToFile (const int ms_id, const unsigned int cubit_bc_type, const int dim, const std::string file_name="out_meshset.vtk", const bool recursive=false, const std::string file_type="VTK", const std::string options="") const
 save cubit meshset entities on the moab mesh
 
boost::shared_ptr< boost::program_options::options_description > & getConfigFileOptionsPtr ()
 Get config file options, use with care.
 
MoFEMErrorCode updateAllMeshsetsByEntitiesChildren (const BitRefLevel &bit)
 Update all blocksets, sidesets and node sets.
 
- Public Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (bool error_if_registration_failed=true)
 Register interface.
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface reference to pointer of interface.
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface.
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface.
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface.
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface.
 
virtual ~UnknownInterface ()=default
 

Static Public Member Functions

static MoFEMErrorCode getTags (moab::Interface &moab, Tag &nsTag, Tag &ssTag, Tag &nsTag_data, Tag &ssTag_data, Tag &bhTag, Tag &bhTag_header, int verb=-1)
 Static version of getTags for external MOAB interface.
 
static void sortMeshsets (std::vector< const CubitMeshSets * > &vec_ptr)
 
- Static Public Member Functions inherited from MoFEM::UnknownInterface
static MoFEMErrorCode getLibVersion (Version &version)
 Get library version.
 
static MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version)
 Get database major version.
 
static MoFEMErrorCode setFileVersion (moab::Interface &moab, Version version=Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD))
 Get database major version.
 
static MoFEMErrorCode getInterfaceVersion (Version &version)
 Get database major version.
 

Public Attributes

MoFEM::CorecOre
 Reference to MoFEM Core interface.
 

Static Public Attributes

static bool broadcastMeshsetsOn = true
 

Protected Attributes

Tag nsTag
 
Tag ssTag
 
Tag nsTag_data
 
Tag ssTag_data
 
Tag bhTag
 
Tag bhTag_header
 
CubitMeshSet_multiIndex cubitMeshsets
 cubit meshsets
 
boost::shared_ptr< boost::program_options::options_description > configFileOptionsPtr
 config file options
 

Detailed Description

Interface for managing meshsets containing materials and boundary conditions.

The MeshsetsManager provides comprehensive functionality for creating, managing, and querying mesh sets (materials, boundary conditions, and blocks) within the MoFEM framework. It serves as the foundation for higher-level boundary condition management and integrates seamlessly with various meshing software formats.

Connection to BcManager

The MeshsetsManager acts as the data layer for the BcManager interface:

MOAB Meshset Integration

MeshsetsManager leverages MOAB's native meshset capabilities:

CUBIT/Coreform Meshset Types

NODESET

SIDESET <br>

BLOCKSET

Generic Multi-Format Support

The MeshsetsManager approach is not restricted to CUBIT and supports multiple meshing formats:

Gmsh Integration

Salome/MED Format Support

Other Format Support

Typical Multi-Format Workflow

  1. Mesh Import: Load mesh with native format-specific group definitions
  2. Tag Discovery: MeshsetsManager discovers and categorizes existing tags
  3. Meshset Creation: Convert format-specific groups to unified meshset representation
  4. Data Association: Attach material properties and boundary condition data
  5. Validation: Verify meshset consistency and completeness
  6. Problem Setup: Use meshsets for finite element problem definition

Key Capabilities

Examples
/home/lk58p/mofem_install/vanilla_dev_release/mofem-cephas/mofem/users_modules/eshelbian_plasticity/src/impl/EshelbianPlasticity.cpp, ep.cpp, mofem/atom_tests/add_blockset.cpp, mofem/atom_tests/add_cubit_meshsets.cpp, mofem/atom_tests/cubit_bc_test.cpp, mofem/atom_tests/prism_elements_from_surface.cpp, mofem/tools/mesh_cut.cpp, mofem/tools/mesh_smoothing.cpp, mofem/tools/meshset_to_vtk.cpp, mofem/tools/split_sideset.cpp, mofem/tutorials/adv-0_plasticity/plastic.cpp, mofem/tutorials/adv-4_dynamic_first_order_con_law/dynamic_first_order_con_law.cpp, mofem/tutorials/adv-5_poroelasticity/seepage.cpp, mofem/tutorials/cor-0to1_unsaturated_transport/unsaturated_transport.cpp, mofem/tutorials/cor-7_elasticity_mixed_formulation/elasticity_mixed_formulation.cpp, mofem/tutorials/cor-9_reaction_diffusion/reaction_diffusion.cpp, mofem/tutorials/scl-6_heat_equation/heat_equation.cpp, mofem/tutorials/vec-3_nonlinear_dynamics/nonlinear_dynamic_elastic.cpp, mofem/tutorials/vec-5_free_surface/free_surface.cpp, mofem/tutorials/vec-7_shape_optimisation/adjoint.cpp, mofem/users_modules/adolc-plasticity/adolc_plasticity.cpp, mofem/users_modules/basic_finite_elements/elasticity/elasticity.cpp, mofem/users_modules/eshelbian_plasticity/ep.cpp, plastic.cpp, thermo_elastic.cpp, and thermoplastic.cpp.

Definition at line 208 of file MeshsetsManager.hpp.

Constructor & Destructor Documentation

◆ MeshsetsManager()

MoFEM::MeshsetsManager::MeshsetsManager ( const MoFEM::Core core)

Constructor for MeshsetsManager.

Parameters
corereference to MoFEM Core interface for accessing mesh and field data

Definition at line 34 of file MeshsetsManager.cpp.

35 : cOre(const_cast<Core &>(core)) {
36
37 if (!LogManager::checkIfChannelExist("MeshsetMngWorld")) {
38 auto core_log = logging::core::get();
39
40 core_log->add_sink(
42 core_log->add_sink(
44 core_log->add_sink(
46
47 LogManager::setLog("MeshsetMngWorld");
48 LogManager::setLog("MeshsetMngSync");
49 LogManager::setLog("MeshsetMngSelf");
50
51 MOFEM_LOG_TAG("MeshsetMngWorld", "MeshsetMng");
52 MOFEM_LOG_TAG("MeshsetMngSync", "MeshsetMng");
53 MOFEM_LOG_TAG("MeshsetMngSelf", "MeshsetMng");
54 }
55
56 MOFEM_LOG("MeshsetMngWorld", Sev::noisy) << "Mashset manager created";
57}
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
#define MOFEM_LOG(channel, severity)
Log.
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
CoreTmp< 0 > Core
Definition Core.hpp:1148
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
static boost::shared_ptr< std::ostream > getStrmSync()
Get the strm sync object.
static bool checkIfChannelExist(const std::string channel)
Check if channel exist.
static boost::shared_ptr< std::ostream > getStrmSelf()
Get the strm self object.
MoFEM::Core & cOre
Reference to MoFEM Core interface.

◆ ~MeshsetsManager()

virtual MoFEM::MeshsetsManager::~MeshsetsManager ( )
virtualdefault

Member Function Documentation

◆ checkIfMeshsetContainsEntities()

bool MoFEM::MeshsetsManager::checkIfMeshsetContainsEntities ( const int  ms_id,
const unsigned int  cubit_bc_type,
const EntityHandle entities,
int  num_entities,
const int  operation_type = moab::Interface::INTERSECT 
)

Check if meshset constains entities.

Parameters
ms_id
cubit_bc_type
entities
num_entities
operation_type
Returns
true
false

Definition at line 737 of file MeshsetsManager.cpp.

739 {
740 auto miit =
741 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
742 boost::make_tuple(ms_id, cubit_bc_type));
743 if (miit !=
744 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
745 Interface &m_field = cOre;
746 return m_field.get_moab().contains_entities(miit->meshset, entities,
747 num_entities, operation_type);
748 } else
749 return false;
750}
DeprecatedCoreInterface Interface
moab::Interface & get_moab()
Definition Core.hpp:322
CubitMeshSet_multiIndex cubitMeshsets
cubit meshsets

◆ get_bhTag()

Tag MoFEM::MeshsetsManager::get_bhTag ( ) const
inline

get tag handle used to store "id" of BLOCKSET

Definition at line 284 of file MeshsetsManager.hpp.

◆ get_bhTag_header()

Tag MoFEM::MeshsetsManager::get_bhTag_header ( ) const
inline

get tag handle used to store of block set header (Used by Cubit)

Definition at line 289 of file MeshsetsManager.hpp.

◆ get_meshsets_manager_ptr() [1/2]

MeshsetsManager * MoFEM::MeshsetsManager::get_meshsets_manager_ptr ( )
inline

return pointer to meshset manager

Definition at line 294 of file MeshsetsManager.hpp.

294{ return this; }

◆ get_meshsets_manager_ptr() [2/2]

const MeshsetsManager * MoFEM::MeshsetsManager::get_meshsets_manager_ptr ( ) const
inline

return pointer to meshset manager

Definition at line 299 of file MeshsetsManager.hpp.

299{ return this; }

◆ get_nsTag()

Tag MoFEM::MeshsetsManager::get_nsTag ( ) const
inline

get tag handle used to store "id" of NODESET

Definition at line 264 of file MeshsetsManager.hpp.

◆ get_nsTag_data()

Tag MoFEM::MeshsetsManager::get_nsTag_data ( ) const
inline

get tag handle used to store boundary data on NODESET

Definition at line 274 of file MeshsetsManager.hpp.

◆ get_ssTag()

Tag MoFEM::MeshsetsManager::get_ssTag ( ) const
inline

get tag handle used to store "id" of SIDESET

Definition at line 269 of file MeshsetsManager.hpp.

◆ get_ssTag_data()

Tag MoFEM::MeshsetsManager::get_ssTag_data ( ) const
inline

get tag handle used to store boundary data on SIDESET

Definition at line 279 of file MeshsetsManager.hpp.

◆ getConfigFileOptionsPtr()

boost::shared_ptr< boost::program_options::options_description > & MoFEM::MeshsetsManager::getConfigFileOptionsPtr ( )
inline

Get config file options, use with care.

Returns
error code

Definition at line 1123 of file MeshsetsManager.hpp.

1123 {
1124 return configFileOptionsPtr;
1125 }
boost::shared_ptr< boost::program_options::options_description > configFileOptionsPtr
config file options

◆ getMeshsetsMultindex()

CubitMeshSet_multiIndex & MoFEM::MeshsetsManager::getMeshsetsMultindex ( )
inline
Examples
mofem/tools/meshset_to_vtk.cpp.

Definition at line 421 of file MeshsetsManager.hpp.

421 {
422 return cubitMeshsets;
423 }

◆ printBcSet()

template<class CUBIT_BC_DATA_TYPE >
MoFEMErrorCode MoFEM::MeshsetsManager::printBcSet ( CUBIT_BC_DATA_TYPE &  data,
unsigned long int  type 
) const

Definition at line 1156 of file MeshsetsManager.hpp.

1157 {
1159 const MoFEM::Interface &m_field = cOre;
1160 const moab::Interface &moab = m_field.get_moab();
1161 for (auto it : getCubitMeshsetPtr(type)) {
1162 CHKERR it->getBcDataStructure(data);
1163 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *it;
1164 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << data;
1165 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << "name " << it->getName();
1166 for (EntityType t = MBVERTEX; t != MBENTITYSET; ++t) {
1167 int nb;
1168 CHKERR moab.get_number_entities_by_type(it->meshset, t, nb, true);
1169 if (nb > 0) {
1170 MOFEM_LOG("MeshsetMngSync", Sev::inform)
1171 << "msId " << it->getMeshsetId() << " number of "
1172 << moab::CN::EntityTypeName(t) << " " << nb;
1173 }
1174 }
1175 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::inform);
1176 }
1178}
#define MOFEM_LOG_SEVERITY_SYNC(comm, severity)
Synchronise "SYNC" on curtain severity level.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
MoFEMErrorCode getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr) const
get cubit meshset
constexpr double t
plate stiffness
Definition plate.cpp:58
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
Deprecated interface functions.

◆ query_interface()

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

Query interface for MeshsetsManager.

Parameters
type_indextype index for the interface to query
ifacepointer to store the interface
Returns
MoFEMErrorCode Error code indicating success or failure

Implements MoFEM::UnknownInterface.

Definition at line 28 of file MeshsetsManager.cpp.

29 {
30 *iface = const_cast<MeshsetsManager *>(this);
31 return 0;
32}
MeshsetsManager(const MoFEM::Core &core)
Constructor for MeshsetsManager.

◆ saveMeshsetToFile() [1/2]

MoFEMErrorCode MoFEM::MeshsetsManager::saveMeshsetToFile ( const int  ms_id,
const unsigned int  cubit_bc_type,
const int  dim,
const std::string  file_name = "out_meshset.vtk",
const bool  recursive = false,
const std::string  file_type = "VTK",
const std::string  options = "" 
) const

save cubit meshset entities on the moab mesh

Parameters
ms_idid of the cubit meshset
cubit_bc_typetype of a cubit mesheset (NODESET SIDESET BLOCKSET)
dimdimension of the entities
file_nameoptional name for the file
file_typeoptional file type for moab (VTK MOAB)
optionsoptional parameters for moab writer (PARALLEL=WRITE_PART)
Returns
MoFEMErrorCode

Definition at line 1487 of file MeshsetsManager.cpp.

1490 {
1491
1493 MoFEM::Interface &m_field = cOre;
1494 moab::Interface &moab = m_field.get_moab();
1495 Range entities;
1496 CHKERR getEntitiesByDimension(ms_id, cubit_bc_type, dim, entities, recursive);
1497 EntityHandle meshset;
1498 CHKERR moab.create_meshset(MESHSET_SET, meshset);
1499 CHKERR moab.add_entities(meshset, entities);
1500 CHKERR moab.write_file(file_name.c_str(), file_type.c_str(), options.c_str(),
1501 &meshset, 1);
1502 CHKERR moab.delete_entities(&meshset, 1);
1504}
MoFEMErrorCode getEntitiesByDimension(const int ms_id, const unsigned int cubit_bc_type, const int dimension, Range &entities, const bool recursive=true) const
get entities from CUBIT/meshset of a particular entity dimension

◆ saveMeshsetToFile() [2/2]

MoFEMErrorCode MoFEM::MeshsetsManager::saveMeshsetToFile ( const int  ms_id,
const unsigned int  cubit_bc_type,
const std::string  file_name = "out_meshset.vtk",
const std::string  file_type = "VTK",
const std::string  options = "" 
) const

save cubit meshset entities on the moab mesh

Parameters
ms_idid of the cubit meshset (NODESET SIDESET BLOCKSET)
cubit_bc_typetype of a cubit mesheset
file_nameoptional name for the file
file_typeoptional file type for moab (VTK MOAB)
optionsoptional parameters for moab writer (PARALLEL=WRITE_PART)
Returns
MoFEMErrorCode
Examples
mofem/tools/meshset_to_vtk.cpp.

Definition at line 1472 of file MeshsetsManager.cpp.

1475 {
1476
1478 MoFEM::Interface &m_field = cOre;
1479 const CubitMeshSets *cubit_meshset_ptr;
1480 CHKERR getCubitMeshsetPtr(ms_id, cubit_bc_type, &cubit_meshset_ptr);
1481 EntityHandle meshset = cubit_meshset_ptr->getMeshset();
1482 CHKERR m_field.get_moab().write_file(file_name.c_str(), file_type.c_str(),
1483 options.c_str(), &meshset, 1);
1485}

◆ setAtributes()

DEPRECATED auto MoFEM::MeshsetsManager::setAtributes ( const CubitBCType  cubit_bc_type,
const int  ms_id,
const std::vector< double > &  attributes,
const std::string  name = "" 
)
inline

Definition at line 663 of file MeshsetsManager.hpp.

666 {
667 return setAttributes(cubit_bc_type, ms_id,
668 std::vector<double>(attributes), name);
669 }
MoFEMErrorCode setAttributes(const CubitBCType cubit_bc_type, const int ms_id, const std::vector< double > &attributes, const std::string name="")
Set attributes for CUBIT meshset.

◆ setAtributesByDataStructure()

DEPRECATED auto MoFEM::MeshsetsManager::setAtributesByDataStructure ( const CubitBCType  cubit_bc_type,
const int  ms_id,
const GenericAttributeData data,
const std::string  name = "" 
)
inline
Examples
mofem/atom_tests/add_cubit_meshsets.cpp.

Definition at line 690 of file MeshsetsManager.hpp.

692 {
693 return setAttributesByDataStructure(cubit_bc_type, ms_id, data, name);
694 }
MoFEMErrorCode setAttributesByDataStructure(const CubitBCType cubit_bc_type, const int ms_id, const GenericAttributeData &data, const std::string name="")
Set attributes using data structure.

◆ setMeshsetFromFile()

MoFEMErrorCode MoFEM::MeshsetsManager::setMeshsetFromFile ( const string  file_name,
const bool  clean_file_options = true 
)

add blocksets reading config file

Example of config file

[block_1001]
# Example applying attributes to blockset
id=2001
user1=1.0 # attribute value 1
user2=2.0 # you can set up to 10 attributes (if needed could be easily
extended to more, let us know)
user3=3.0
[block_1002]
# Example applying material block (isotropic elastic material)
id=2002
name=MAT_ELASTIC
young=10
poisson=0.25
thermalexpansion=0
[block_1003]
# Example applying displacement constrains
id=2003
# Each flag means that boundary consition on displacements is set.
disp_flag1=1 # Setting constrains in x- direction
disp_flag2=1 # Setting constrains in y- direction
disp_flag3=1 # Setting constrains in z- direction
disp_flag4=1 # Setting constrains on rotation over x- axis
disp_flag5=1 # Setting constrains on rotation over y- axis
disp_flag6=1 # Setting constrains on rotation over z-axis
disp_ux=1 # value of disp in x- direction
disp_uy=2
disp_uz=3
disp_rx=4 # value of rotation in y-direction
disp_ry=5
disp_rz=6
# Note above values could be interpreted differently if needed.
[block_1004]
# Example applying force boundary conditions
id=2004
force_magnitude=1
moment_magnitude=1
force_fx=1
force_fy=1
force_fz=1
moment_mx=1
moment_my=1
moment_mz=1
[block_1005]
# Example applying pressure boundary conditions
id=2005
pressure_flag2=1 # 0: Pressure is interpreted as pure pressure 1:
pressure is interpreted as total force
pressure_magnitude=1
# Example applying temperature boundary conditions
[block_1006]
id=2006
temperature_flag1=1 # 0: N/A, 1: temperature value applied
temperature_t=1
[block_1007]
id=2007
heatflux_flag1=1 # 0: N/A, 1: heat flux applied
heatflux_magnitude=1
[block_1008]
# Example applying material block (isotropic thermal material)
id=2008
name=MAT_THERMAL # Hast to be set for Thermal Mat
conductivity=1
capacity=1
[block_1009]
# Example applying interface
id=2009
interface_type=1
[block_1010]
# Example applying material block for interface element
id=2010
name=MAT_INTERF
interface_alpha = 1
interface_beta = 0
interface_ft = 1
interface_Gf = 1
[block_1009]
# Example applying material block (isotropic trans iso material)
id=2011
name=MAT_ELASTIC_TRANS_ISO
Youngp=1
Youngz=2
Poissonp=3
Poissonpz=4
Shearzp=5
[SET_ATTR_foo]
# Example set atttributes to block name "foo"
number_of_attributes=3
user1=1
user2=2
user3=3
@ NODESET
@ SIDESET
@ BLOCKSET
constexpr AssemblyType A
const int N
Definition speed_test.cpp:3
Parameters
file_namepath to configuration file containing meshset definitions
clean_file_optionswhether to clean existing file options before loading
Returns
MoFEMErrorCode Error code indicating success or failure
Examples
mofem/atom_tests/add_cubit_meshsets.cpp, mofem/tools/meshset_to_vtk.cpp, and mofem/tutorials/cor-0to1_unsaturated_transport/unsaturated_transport.cpp.

Definition at line 802 of file MeshsetsManager.cpp.

803 {
804 Interface &m_field = cOre;
806 std::ifstream ini_file(file_name.c_str(), std::ifstream::in);
807 po::variables_map vm;
808 if (clean_file_options) {
810 boost::shared_ptr<boost::program_options::options_description>(
811 new po::options_description());
812 }
813
814 auto add_block_attributes = [&](auto prefix, auto &block_lists, auto &it) {
815 // remove spacec from blockset name
816 configFileOptionsPtr->add_options()(
817 (prefix + ".number_of_attributes").c_str(),
818 po::value<int>(&block_lists[it->getMeshsetId()].numberOfAttributes)
819 ->default_value(-1),
820 "Number of blockset attribute");
821 for (int ii = 1; ii <= 10; ii++) {
822 std::string surfix = ".user" + boost::lexical_cast<std::string>(ii);
823 configFileOptionsPtr->add_options()(
824 (prefix + surfix).c_str(),
825 po::value<double>(&block_lists[it->getMeshsetId()].aTtr[ii - 1])
826 ->default_value(0.0),
827 "Add block attribute");
828 }
829 };
830
831 // Add blocks
832 map<int, BlockData> block_lists;
834 const auto id = it->getMeshsetId();
835 block_lists[id].cubitMeshset = it->getMeshset();
836 std::string prefix =
837 "block_" + boost::lexical_cast<std::string>(id);
838 configFileOptionsPtr->add_options()(
839 (prefix + ".add").c_str(),
840 po::value<string>(&block_lists[it->getMeshsetId()].addType)
841 ->default_value("UNKNOWNSET"),
842 "Add block set")(
843 (prefix + ".id").c_str(),
844 po::value<int>(&block_lists[it->getMeshsetId()].iD)->default_value(-1),
845 "Id of meshset")(
846 (prefix + ".name").c_str(),
847 po::value<string>(&block_lists[it->getMeshsetId()].nAme)
848 ->default_value(""),
849 "Name of the meshset");
850
851 // Block attributes
852 add_block_attributes(prefix, block_lists, it);
853
854 // Mat elastic
855 {
856 // double Young; ///< Young's modulus
857 // double Poisson; ///< Poisson's ratio
858 // double ThermalExpansion; ///< Thermal expansion
859 configFileOptionsPtr->add_options()(
860 (prefix + ".young").c_str(),
861 po::value<double>()->default_value(-1)->notifier(
862 [&block_lists, id](double v) {
863 block_lists[id].matElastic.data.Young = v;
864 }),
865 "Young modulus")(
866 (prefix + ".poisson").c_str(),
867 po::value<double>()->default_value(-2)->notifier(
868 [&block_lists, id](double v) {
869 block_lists[id].matElastic.data.Poisson = v;
870 }),
871 "Poisson ratio")(
872 (prefix + ".thermalexpansion").c_str(),
873 po::value<double>()->default_value(-1)->notifier(
874 [&block_lists, id](double v) {
875 block_lists[id].matElastic.data.ThermalExpansion = v;
876 }),
877 "Thermal expansion");
878 // TODO Add users parameters
879 }
880 // Mat Trans Iso
881 {
882 // Young's modulus in xy plane (Ep)
883 // Young's modulus in z-direction (Ez)
884 // Poisson's ratio in xy plane (vp)
885 // Poisson's ratio in z-direction (vpz)
886 // Shear modulus in z-direction (Gzp)
887 configFileOptionsPtr->add_options()(
888 (prefix + ".Youngp").c_str(),
889 po::value<double>()->default_value(-1)->notifier(
890 [&block_lists, id](double v) {
891 block_lists[id].matTransIso.data.Youngp = v;
892 }),
893 "Youngp")(
894 (prefix + ".Youngz").c_str(),
895 po::value<double>()->default_value(-1)->notifier(
896 [&block_lists, id](double v) {
897 block_lists[id].matTransIso.data.Youngz = v;
898 }),
899 "Youngz")(
900 (prefix + ".Poissonp").c_str(),
901 po::value<double>()->default_value(0)->notifier(
902 [&block_lists, id](double v) {
903 block_lists[id].matTransIso.data.Poissonp = v;
904 }),
905 "Poissonp")(
906 (prefix + ".Poissonpz").c_str(),
907 po::value<double>()->default_value(0)->notifier(
908 [&block_lists, id](double v) {
909 block_lists[id].matTransIso.data.Poissonpz = v;
910 }),
911 "Poissonpz")(
912 (prefix + ".Shearzp").c_str(),
913 po::value<double>()->default_value(-1)->notifier(
914 [&block_lists, id](double v) {
915 block_lists[id].matTransIso.data.Shearzp = v;
916 }),
917 "Shearzp");
918 // TODO Add users parameters
919 }
920 // Mat thermal
921 {
922 // double Conductivity; ///< Thermal conductivity
923 // double HeatCapacity; ///< Heat Capacity
924 configFileOptionsPtr->add_options()(
925 (prefix + ".conductivity").c_str(),
926 po::value<double>()->default_value(-1)->notifier(
927 [&block_lists, id](double v) {
928 block_lists[id].matThermal.data.Conductivity = v;
929 }),
930 "Conductivity")(
931 (prefix + ".capacity").c_str(),
932 po::value<double>()->default_value(-1)->notifier(
933 [&block_lists, id](double v) {
934 block_lists[id].matThermal.data.HeatCapacity = v;
935 }),
936 "Capacity");
937 // TODO Add users parameters
938 }
939 // Mat interface
940 {
941 // double alpha; ///< Elastic modulus multiplier
942 // double beta; ///< Damage Coupling multiplier between normal and
943 // shear (g=sqrt(gn^2 + beta(gt1^2 + gt2^2))) double ft; ///< Maximum
944 // stress of crack double Gf; ///< Fracture Energy
945 configFileOptionsPtr->add_options()(
946 (prefix + ".interface_alpha").c_str(),
947 po::value<double>()->default_value(-1)->notifier(
948 [&block_lists, id](double v) {
949 block_lists[id].matInterf.data.alpha = v;
950 }),
951 "alpha")((prefix + ".interface_beta").c_str(),
952 po::value<double>()->default_value(-1)->notifier(
953 [&block_lists, id](double v) {
954 block_lists[id].matInterf.data.beta = v;
955 }),
956 "beta")(
957 (prefix + ".interface_ft").c_str(),
958 po::value<double>()->default_value(-1)->notifier(
959 [&block_lists, id](double v) {
960 block_lists[id].matInterf.data.ft = v;
961 }),
962 "ft")(
963 (prefix + ".interface_Gf").c_str(),
964 po::value<double>()->default_value(-1)->notifier(
965 [&block_lists, id](double v) {
966 block_lists[id].matInterf.data.Gf = v;
967 }),
968 "Gf");
969 // TODO Add users parameters
970 }
971
972 // Displacement bc
973 {
974 // char flag1; //< Flag for X-Translation (0: N/A, 1: specified)
975 // char flag2; //< Flag for Y-Translation (0: N/A, 1: specified)
976 // char flag3; //< Flag for Z-Translation (0: N/A, 1: specified)
977 // char flag4; //< Flag for X-Rotation (0: N/A, 1: specified)
978 // char flag5; //< Flag for Y-Rotation (0: N/A, 1: specified)
979 // char flag6; //< Flag for Z-Rotation (0: N/A, 1: specified)
980 // double value1; //< Value for X-Translation
981 // double value2; //< Value for Y-Translation
982 // double value3; //< Value for Z-Translation
983 // double value4; //< Value for X-Rotation
984 // double value5; //< Value for Y-Rotation
985 // double value6; //< Value for Z-Rotation
986 configFileOptionsPtr->add_options()(
987 (prefix + ".disp_flag1").c_str(),
988 po::value<char>()->default_value(0)->notifier(
989 [&block_lists, id](char v) {
990 block_lists[id].dispBc.data.flag1 = v;
991 }),
992 "flag1")(
993 (prefix + ".disp_flag2").c_str(),
994 po::value<char>()->default_value(0)->notifier(
995 [&block_lists, id](char v) {
996 block_lists[id].dispBc.data.flag2 = v;
997 }),
998 "flag2")(
999 (prefix + ".disp_flag3").c_str(),
1000 po::value<char>()->default_value(0)->notifier(
1001 [&block_lists, id](char v) {
1002 block_lists[id].dispBc.data.flag3 = v;
1003 }),
1004 "flag3")(
1005 (prefix + ".disp_flag4").c_str(),
1006 po::value<char>()->default_value(0)->notifier(
1007 [&block_lists, id](char v) {
1008 block_lists[id].dispBc.data.flag4 = v;
1009 }),
1010 "flag4")(
1011 (prefix + ".disp_flag5").c_str(),
1012 po::value<char>()->default_value(0)->notifier(
1013 [&block_lists, id](char v) {
1014 block_lists[id].dispBc.data.flag5 = v;
1015 }),
1016 "flag5")(
1017 (prefix + ".disp_flag6").c_str(),
1018 po::value<char>()->default_value(0)->notifier(
1019 [&block_lists, id](char v) {
1020 block_lists[id].dispBc.data.flag6 = v;
1021 }),
1022 "flag6")(
1023 (prefix + ".disp_ux").c_str(),
1024 po::value<double>()->default_value(0)->notifier(
1025 [&block_lists, id](double v) {
1026 block_lists[id].dispBc.data.value1 = v;
1027 }),
1028 "value1")(
1029 (prefix + ".disp_uy").c_str(),
1030 po::value<double>()->default_value(0)->notifier(
1031 [&block_lists, id](double v) {
1032 block_lists[id].dispBc.data.value2 = v;
1033 }),
1034 "value2")(
1035 (prefix + ".disp_uz").c_str(),
1036 po::value<double>()->default_value(0)->notifier(
1037 [&block_lists, id](double v) {
1038 block_lists[id].dispBc.data.value3 = v;
1039 }),
1040 "value3")(
1041 (prefix + ".disp_rx").c_str(),
1042 po::value<double>()->default_value(0)->notifier(
1043 [&block_lists, id](double v) {
1044 block_lists[id].dispBc.data.value4 = v;
1045 }),
1046 "value4")(
1047 (prefix + ".disp_ry").c_str(),
1048 po::value<double>()->default_value(0)->notifier(
1049 [&block_lists, id](double v) {
1050 block_lists[id].dispBc.data.value5 = v;
1051 }),
1052 "value5")(
1053 (prefix + ".disp_rz").c_str(),
1054 po::value<double>()->default_value(0)->notifier(
1055 [&block_lists, id](double v) {
1056 block_lists[id].dispBc.data.value6 = v;
1057 }),
1058 "value6");
1059 }
1060 // Force BC data
1061 {
1062 // char zero[3]; //< 3 zeros
1063 // double value1; //< Force magnitude
1064 // double value2; //< Moment magnitude
1065 // double value3; //< X-component of force direction vector
1066 // double value4; //< Y-component of force direction vector
1067 // double value5; //< Z-component of force direction vector
1068 // double value6; //< X-component of moment direction vector
1069 // double value7; //< Y-component of moment direction vector
1070 // double value8; //< Z-component of moment direction vector
1071 // char zero2; // 0
1072 configFileOptionsPtr->add_options()(
1073 (prefix + ".force_magnitude").c_str(),
1074 po::value<double>()->default_value(0)->notifier(
1075 [&block_lists, id](double v) {
1076 block_lists[id].forceBc.data.value1 = v;
1077 }),
1078 "value1")((prefix + ".moment_magnitude").c_str(),
1079 po::value<double>()->default_value(0)->notifier(
1080 [&block_lists, id](double v) {
1081 block_lists[id].forceBc.data.value2 = v;
1082 }),
1083 "value2")(
1084 (prefix + ".force_fx").c_str(),
1085 po::value<double>()->default_value(0)->notifier(
1086 [&block_lists, id](double v) {
1087 block_lists[id].forceBc.data.value3 = v;
1088 }),
1089 "value3")((prefix + ".force_fy").c_str(),
1090 po::value<double>()->default_value(0)->notifier(
1091 [&block_lists, id](double v) {
1092 block_lists[id].forceBc.data.value4 = v;
1093 }),
1094 "value4")(
1095 (prefix + ".force_fz").c_str(),
1096 po::value<double>()->default_value(0)->notifier(
1097 [&block_lists, id](double v) {
1098 block_lists[id].forceBc.data.value5 = v;
1099 }),
1100 "value5")((prefix + ".moment_mx").c_str(),
1101 po::value<double>()->default_value(0)->notifier(
1102 [&block_lists, id](double v) {
1103 block_lists[id].forceBc.data.value6 = v;
1104 }),
1105 "value6")(
1106 (prefix + ".moment_my").c_str(),
1107 po::value<double>()->default_value(0)->notifier(
1108 [&block_lists, id](double v) {
1109 block_lists[id].forceBc.data.value7 = v;
1110 }),
1111 "value7")((prefix + ".moment_mz").c_str(),
1112 po::value<double>()->default_value(0)->notifier(
1113 [&block_lists, id](double v) {
1114 block_lists[id].forceBc.data.value8 = v;
1115 }),
1116 "value8");
1117 }
1118 {
1119 // char name[11]; //< 11 characters for "Temperature"
1120 // char pre1; //< This is always zero
1121 // char pre2; //< 0: temperature is not applied on thin shells
1122 // (default); 1: temperature is applied on thin shells char flag1; //<
1123 // 0: N/A, 1: temperature value applied (not on thin shells) char flag2;
1124 // //< 0: N/A, 1: temperature applied on thin shell middle char flag3;
1125 // //< 0: N/A, 1: thin shell temperature gradient specified char flag4;
1126 // //< 0: N/A, 1: top thin shell temperature char flag5; //< 0: N/A, 1:
1127 // bottom thin shell temperature char flag6; //< This is always zero
1128 // double value1; //< Temperature (default case - no thin shells)
1129 // double value2; //< Temperature for middle of thin shells
1130 // double value3; //< Temperature gradient for thin shells
1131 // double value4; //< Temperature for top of thin shells
1132 // double value5; //< Temperature for bottom of thin shells
1133 // double value6; //< This is always zero, i.e. ignore
1134 configFileOptionsPtr->add_options()(
1135 (prefix + ".temperature_flag1").c_str(),
1136 po::value<char>()->default_value(0)->notifier(
1137 [&block_lists, id](char v) {
1138 block_lists[id].temperatureBc.data.flag1 = v;
1139 }),
1140 "flag1")(
1141 (prefix + ".temperature_t").c_str(),
1142 po::value<double>()->default_value(0)->notifier(
1143 [&block_lists, id](double v) {
1144 block_lists[id].temperatureBc.data.value1 = v;
1145 }),
1146 "value1");
1147 // TODO: Add more cases, see above
1148 }
1149 // Sideset
1150 {
1151 // char name[8]; //< 8 characters for "Pressure"
1152 // char zero; //< This is always zero
1153 // char flag2; //< 0: Pressure is interpreted as pure pressure 1:
1154 // pressure is interpreted as total force double value1; //< Pressure
1155 // value
1156 configFileOptionsPtr->add_options()(
1157 (prefix + ".pressure_flag2").c_str(),
1158 po::value<char>()->default_value(0)->notifier(
1159 [&block_lists, id](char v) {
1160 block_lists[id].pressureBc.data.flag2 = v;
1161 }),
1162 "flag2")((prefix + ".pressure_magnitude").c_str(),
1163 po::value<double>()->default_value(0)->notifier(
1164 [&block_lists, id](double v) {
1165 block_lists[id].pressureBc.data.value1 = v;
1166 }),
1167 "value1");
1168 }
1169 {
1170 // char name[8]; //< 8 characters for "HeatFlux" (no space)
1171 // char pre1; //< This is always zero
1172 // char pre2; //< 0: heat flux is not applied on thin shells (default);
1173 // 1: heat flux is applied on thin shells char flag1; //< 0: N/A, 1:
1174 // normal heat flux case (i.e. single value, case without thin shells)
1175 // char flag2; //< 0: N/A, 1: Thin shell top heat flux specified
1176 // char flag3; //< 0: N/A, 1: Thin shell bottom heat flux specidied
1177 // double value1; //< Heat flux value for default case (no thin shells)
1178 // double value2; //< Heat flux (thin shell top)
1179 // double value3; //< Heat flux (thin shell bottom)
1180 configFileOptionsPtr->add_options()(
1181 (prefix + ".heatflux_flag1").c_str(),
1182 po::value<char>()->default_value(0)->notifier(
1183 [&block_lists, id](char v) {
1184 block_lists[id].heatFluxBc.data.flag1 = v;
1185 }),
1186 "flag1")((prefix + ".heatflux_magnitude").c_str(),
1187 po::value<double>()->default_value(0)->notifier(
1188 [&block_lists, id](double v) {
1189 block_lists[id].heatFluxBc.data.value1 = v;
1190 }),
1191 "value1");
1192 }
1193 // Interface set
1194 {
1195 configFileOptionsPtr->add_options()(
1196 (prefix + ".interface_type").c_str(),
1197 po::value<char>()->default_value(0)->notifier(
1198 [&block_lists, id](char v) {
1199 block_lists[id].cfgBc.data.type = v;
1200 }),
1201 "type");
1202 }
1203 }
1204
1205 map<int, BlockData> block_set_attributes;
1207 block_set_attributes[it->getMeshsetId()].cubitMeshset = it->getMeshset();
1208 block_set_attributes[it->getMeshsetId()].iD = it->getMeshsetId();
1209 block_set_attributes[it->getMeshsetId()].bcType = BLOCKSET;
1210 std::string block_name = it->getName();
1211 block_name.erase(
1212 std::remove_if(block_name.begin(), block_name.end(), ::isspace),
1213 block_name.end());
1214 block_set_attributes[it->getMeshsetId()].nAme = block_name;
1215 // Only blocks which have name
1216 if (block_name.compare("NoNameSet") != 0) {
1217 std::string prefix = "SET_ATTR_" + block_name;
1218 // Block attributes
1219 add_block_attributes(prefix, block_set_attributes, it);
1220 }
1221 }
1222
1223 po::parsed_options parsed =
1224 parse_config_file(ini_file, *configFileOptionsPtr, true);
1225 store(parsed, vm);
1226 po::notify(vm);
1227
1228 // Set type from name
1230
1231 CubitBCType bc_type;
1232 unsigned jj = 0;
1233 while (1 << jj != LASTSET_BC) {
1234 if (string(CubitBCNames[jj + 1]) ==
1235 block_lists[it->getMeshsetId()].addType) {
1236 bc_type = 1 << jj;
1237 }
1238 ++jj;
1239 }
1240 if (bc_type.none()) {
1241 block_lists[it->getMeshsetId()].bcType = UNKNOWNSET;
1242 // Skip the bockset nothing is defined for it
1243 continue;
1244 }
1245
1246 if (bc_type.to_ulong() == BLOCKSET)
1247 block_lists[it->getMeshsetId()].bcType = BLOCKSET;
1248 else if (bc_type.to_ulong() == NODESET)
1249 block_lists[it->getMeshsetId()].bcType = NODESET;
1250 else if (bc_type.to_ulong() == SIDESET)
1251 block_lists[it->getMeshsetId()].bcType = SIDESET;
1252 else {
1253 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
1254 "Not yet implemented type %s\n",
1255 block_lists[it->getMeshsetId()].addType.c_str());
1256 }
1257 if (block_lists[it->getMeshsetId()].iD == -1) {
1258 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
1259 "Unset iD number %d\n", block_lists[it->getMeshsetId()].iD);
1260 }
1261 }
1262
1263 std::vector<std::string> additional_parameters;
1264 additional_parameters =
1265 collect_unrecognized(parsed.options, po::include_positional);
1266 for (std::vector<std::string>::iterator vit = additional_parameters.begin();
1267 vit != additional_parameters.end(); vit++) {
1268 MOFEM_LOG_C("MeshsetMngSelf", Sev::warning, "Unrecognized option %s",
1269 vit->c_str());
1270 }
1271 for (map<int, BlockData>::iterator mit = block_lists.begin();
1272 mit != block_lists.end(); mit++) {
1273 CubitMeshSet_multiIndex::iterator cubit_meshset_it =
1274 cubitMeshsets.find(mit->second.cubitMeshset);
1275 if (cubit_meshset_it == cubitMeshsets.end()) {
1276 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
1277 "Data inconsistency\n");
1278 }
1279 switch (mit->second.bcType) {
1280 case UNKNOWNSET:
1281 break;
1282 case BLOCKSET: {
1283 if ((CubitBCType(mit->second.bcType) & cubit_meshset_it->getBcType())
1284 .any() &&
1285 mit->second.iD == cubit_meshset_it->getMeshsetId()) {
1286 // Meshset is the same, only modification
1287 } else {
1288 CHKERR addMeshset(mit->second.bcType, mit->second.iD, mit->second.nAme);
1289 EntityHandle meshset = cubit_meshset_it->getMeshset();
1290 CHKERR addEntitiesToMeshset(mit->second.bcType, mit->second.iD,
1291 &meshset, 1);
1292 }
1293 // Add attributes
1294 CHKERR setAttributes(mit->second.bcType, mit->second.iD, mit->second.aTtr);
1295 // Add material elastic data if value are physical (i.e. Young > 0,
1296 // Poisson in (-1.0.5) and ThermalExpansion>0)
1297 if (mit->second.matElastic.data.Young != -1) {
1298 CHKERR setAttributesByDataStructure(mit->second.bcType, mit->second.iD,
1299 mit->second.matElastic);
1300 }
1301 if (mit->second.matTransIso.data.Youngp != -1) {
1302 CHKERR setAttributesByDataStructure(mit->second.bcType, mit->second.iD,
1303 mit->second.matTransIso);
1304 }
1305 if (mit->second.matThermal.data.Conductivity != -1) {
1306 CHKERR setAttributesByDataStructure(mit->second.bcType, mit->second.iD,
1307 mit->second.matThermal);
1308 }
1309 if (mit->second.matInterf.data.ft != -1) {
1310 CHKERR setAttributesByDataStructure(mit->second.bcType, mit->second.iD,
1311 mit->second.matInterf);
1312 }
1313 } break;
1314 case NODESET: {
1315 if ((CubitBCType(mit->second.bcType) & cubit_meshset_it->getBcType())
1316 .any() &&
1317 mit->second.iD == cubit_meshset_it->getMeshsetId()) {
1318 // Meshset is the same, only modification
1319 } else {
1320 CHKERR addMeshset(mit->second.bcType, mit->second.iD);
1321 EntityHandle meshset = cubit_meshset_it->getMeshset();
1322 CHKERR addEntitiesToMeshset(mit->second.bcType, mit->second.iD,
1323 &meshset, 1);
1324 }
1325 // Add displacement bc
1326 if (mit->second.dispBc.data.flag1 || mit->second.dispBc.data.flag2 ||
1327 mit->second.dispBc.data.flag3 || mit->second.dispBc.data.flag4 ||
1328 mit->second.dispBc.data.flag5 || mit->second.dispBc.data.flag6) {
1329 if (mit->second.dispBc.data.flag1 == '0')
1330 mit->second.dispBc.data.flag1 = 0;
1331 if (mit->second.dispBc.data.flag1 == 'N')
1332 mit->second.dispBc.data.flag1 = 0;
1333 if (mit->second.dispBc.data.flag1)
1334 mit->second.dispBc.data.flag1 = 1;
1335 if (mit->second.dispBc.data.flag2 == '0')
1336 mit->second.dispBc.data.flag2 = 0;
1337 if (mit->second.dispBc.data.flag2 == 'N')
1338 mit->second.dispBc.data.flag2 = 0;
1339 if (mit->second.dispBc.data.flag2)
1340 mit->second.dispBc.data.flag2 = 1;
1341 if (mit->second.dispBc.data.flag3 == '0')
1342 mit->second.dispBc.data.flag3 = 0;
1343 if (mit->second.dispBc.data.flag3 == 'N')
1344 mit->second.dispBc.data.flag3 = 0;
1345 if (mit->second.dispBc.data.flag3)
1346 mit->second.dispBc.data.flag3 = 1;
1347 if (mit->second.dispBc.data.flag4 == '0')
1348 mit->second.dispBc.data.flag4 = 0;
1349 if (mit->second.dispBc.data.flag4 == 'N')
1350 mit->second.dispBc.data.flag4 = 0;
1351 if (mit->second.dispBc.data.flag4)
1352 mit->second.dispBc.data.flag4 = 1;
1353 if (mit->second.dispBc.data.flag5 == '0')
1354 mit->second.dispBc.data.flag5 = 0;
1355 if (mit->second.dispBc.data.flag5 == 'N')
1356 mit->second.dispBc.data.flag5 = 0;
1357 if (mit->second.dispBc.data.flag5)
1358 mit->second.dispBc.data.flag5 = 1;
1359 if (mit->second.dispBc.data.flag6 == '0')
1360 mit->second.dispBc.data.flag6 = 0;
1361 if (mit->second.dispBc.data.flag6 == 'N')
1362 mit->second.dispBc.data.flag6 = 0;
1363 if (mit->second.dispBc.data.flag6)
1364 mit->second.dispBc.data.flag6 = 1;
1365 CHKERR setBcData(mit->second.bcType, mit->second.iD,
1366 mit->second.dispBc);
1367 }
1368 if (mit->second.forceBc.data.value1 != 0 ||
1369 mit->second.forceBc.data.value2 != 0) {
1370 CHKERR setBcData(mit->second.bcType, mit->second.iD,
1371 mit->second.forceBc);
1372 }
1373 // Add temperature boundary condition
1374 if (mit->second.temperatureBc.data.flag1) {
1375 if (mit->second.temperatureBc.data.flag1 == '0')
1376 mit->second.temperatureBc.data.flag1 = 0;
1377 if (mit->second.temperatureBc.data.flag1 == 'N')
1378 mit->second.temperatureBc.data.flag1 = 0;
1379 if (mit->second.temperatureBc.data.flag1)
1380 mit->second.temperatureBc.data.flag1 = 1;
1381 CHKERR setBcData(mit->second.bcType, mit->second.iD,
1382 mit->second.temperatureBc);
1383 }
1384 } break;
1385 case SIDESET: {
1386 if ((CubitBCType(mit->second.bcType) & cubit_meshset_it->getBcType())
1387 .any() &&
1388 mit->second.iD == cubit_meshset_it->getMeshsetId()) {
1389 // Meshset is the same, only modification
1390 } else {
1391 CHKERR addMeshset(mit->second.bcType, mit->second.iD);
1392 EntityHandle meshset = cubit_meshset_it->getMeshset();
1393 CHKERR addEntitiesToMeshset(mit->second.bcType, mit->second.iD,
1394 &meshset, 1);
1395 }
1396 // Add pressure
1397 if (mit->second.pressureBc.data.value1 != 0) {
1398 if (mit->second.pressureBc.data.flag2 == '0')
1399 mit->second.pressureBc.data.flag2 = 0;
1400 if (mit->second.pressureBc.data.flag2 == 'N')
1401 mit->second.pressureBc.data.flag2 = 0;
1402 if (mit->second.pressureBc.data.flag2)
1403 mit->second.pressureBc.data.flag2 = 1;
1404 CHKERR setBcData(mit->second.bcType, mit->second.iD,
1405 mit->second.pressureBc);
1406 }
1407 // Add heat flux
1408 if (mit->second.heatFluxBc.data.value1 != 0) {
1409 if (mit->second.heatFluxBc.data.flag1 == '0')
1410 mit->second.heatFluxBc.data.flag1 = 0;
1411 if (mit->second.heatFluxBc.data.flag1 == 'N')
1412 mit->second.heatFluxBc.data.flag1 = 0;
1413 if (mit->second.heatFluxBc.data.flag1)
1414 mit->second.heatFluxBc.data.flag1 = 1;
1415 CHKERR setBcData(mit->second.bcType, mit->second.iD,
1416 mit->second.heatFluxBc);
1417 }
1418 // Add Interface
1419 if (mit->second.cfgBc.data.type != 0) {
1420 CHKERR setBcData(mit->second.bcType, mit->second.iD, mit->second.cfgBc);
1421 }
1422 } break;
1423 default:
1424 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
1425 "Not yet implemented type\n");
1426 }
1427 }
1428
1429 for (auto set_attr : block_set_attributes) {
1430 // Add attributes
1431 if (set_attr.second.numberOfAttributes > 0) {
1432 MOFEM_LOG("MeshsetMngSelf", Sev::verbose)
1433 << "Set attributes to blockset " << set_attr.second.nAme;
1434 set_attr.second.aTtr.resize(set_attr.second.numberOfAttributes);
1435 CHKERR setAttributes(set_attr.second.bcType, set_attr.second.iD,
1436 set_attr.second.aTtr);
1437 }
1438 }
1439
1441}
#define MOFEM_LOG_C(channel, severity, format,...)
@ LASTSET_BC
@ UNKNOWNSET
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
static const char *const CubitBCNames[]
Names of types of sets and boundary conditions.
MoFEMErrorCode setBcData(const CubitBCType cubit_bc_type, const int ms_id, const GenericCubitBcData &data)
Set boundary condition data for meshset.
MoFEMErrorCode addEntitiesToMeshset(const CubitBCType cubit_bc_type, const int ms_id, const Range &ents)
Add entities to CUBIT meshset.
MoFEMErrorCode addMeshset(const CubitBCType cubit_bc_type, const int ms_id, const std::string name="")
Add CUBIT meshset to manager.
#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.
const double v
phase velocity of light in medium (cm/ns)
std::bitset< 32 > CubitBCType
Definition Types.hpp:52

◆ sortMeshsets()

void MoFEM::MeshsetsManager::sortMeshsets ( std::vector< const CubitMeshSets * > &  vec_ptr)
static

Definition at line 12 of file MeshsetsManager.cpp.

13 {
14 std::sort(vec_ptr.begin(), vec_ptr.end(),
15 [](const CubitMeshSets *a, const CubitMeshSets *b) {
16 if (a->getBcType().to_ullong() < b->getBcType().to_ullong())
17 return true;
18 if (a->getBcType().to_ullong() > b->getBcType().to_ullong())
19 return false;
20 else
21 return a->getMeshsetId() < b->getMeshsetId();
22 });
23}
constexpr double a

◆ updateAllMeshsetsByEntitiesChildren()

MoFEMErrorCode MoFEM::MeshsetsManager::updateAllMeshsetsByEntitiesChildren ( const BitRefLevel bit)

Update all blocksets, sidesets and node sets.

Parameters
bit
Returns
MoFEMErrorCode
Examples
thermoplastic.cpp.

Definition at line 1507 of file MeshsetsManager.cpp.

1507 {
1509 BitRefManager *bit_mng = cOre.getInterface<BitRefManager>();
1510 for (_IT_CUBITMESHSETS_FOR_LOOP_((*this), iit)) {
1511 EntityHandle meshset = iit->getMeshset();
1512 for (EntityType t = MBVERTEX; t != MBENTITYSET; ++t)
1513 CHKERR bit_mng->updateMeshsetByEntitiesChildren(meshset, bit, meshset, t,
1514 true);
1515 }
1517}
#define _IT_CUBITMESHSETS_FOR_LOOP_(MESHSET_MANAGER, IT)
Iterator that loops over all the Cubit MeshSets in a moFEM field.
auto bit
set bit
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.

Member Data Documentation

◆ bhTag

Tag MoFEM::MeshsetsManager::bhTag
protected

Definition at line 1145 of file MeshsetsManager.hpp.

◆ bhTag_header

Tag MoFEM::MeshsetsManager::bhTag_header
protected

Definition at line 1146 of file MeshsetsManager.hpp.

◆ broadcastMeshsetsOn

bool MoFEM::MeshsetsManager::broadcastMeshsetsOn = true
static

if true meshsets are synchronised between processors

Definition at line 1135 of file MeshsetsManager.hpp.

◆ configFileOptionsPtr

boost::shared_ptr<boost::program_options::options_description> MoFEM::MeshsetsManager::configFileOptionsPtr
protected

config file options

Definition at line 1151 of file MeshsetsManager.hpp.

◆ cOre

MoFEM::Core& MoFEM::MeshsetsManager::cOre

Reference to MoFEM Core interface.

Definition at line 220 of file MeshsetsManager.hpp.

◆ cubitMeshsets

CubitMeshSet_multiIndex MoFEM::MeshsetsManager::cubitMeshsets
protected

cubit meshsets

Definition at line 1149 of file MeshsetsManager.hpp.

◆ nsTag

Tag MoFEM::MeshsetsManager::nsTag
protected

Definition at line 1141 of file MeshsetsManager.hpp.

◆ nsTag_data

Tag MoFEM::MeshsetsManager::nsTag_data
protected

Definition at line 1143 of file MeshsetsManager.hpp.

◆ ssTag

Tag MoFEM::MeshsetsManager::ssTag
protected

Definition at line 1142 of file MeshsetsManager.hpp.

◆ ssTag_data

Tag MoFEM::MeshsetsManager::ssTag_data
protected

Definition at line 1144 of file MeshsetsManager.hpp.


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