v0.15.0
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
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/plastic.cpp, mofem/tutorials/adv-2/thermo_elastic.cpp, mofem/tutorials/adv-4/dynamic_first_order_con_law.cpp, mofem/tutorials/adv-5/seepage.cpp, mofem/tutorials/cor-0to1/unsaturated_transport.cpp, mofem/tutorials/cor-7/elasticity_mixed_formulation.cpp, mofem/tutorials/cor-9/reaction_diffusion.cpp, mofem/tutorials/scl-6/heat_equation.cpp, mofem/tutorials/vec-3/nonlinear_dynamic_elastic.cpp, mofem/tutorials/vec-5/free_surface.cpp, mofem/tutorials/vec-7/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, and mofem/users_modules/eshelbian_plasticity/src/impl/EshelbianPlasticity.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 1430 of file MeshsetsManager.cpp.

1433 {
1434
1436 MoFEM::Interface &m_field = cOre;
1437 moab::Interface &moab = m_field.get_moab();
1438 Range entities;
1439 CHKERR getEntitiesByDimension(ms_id, cubit_bc_type, dim, entities, recursive);
1440 EntityHandle meshset;
1441 CHKERR moab.create_meshset(MESHSET_SET, meshset);
1442 CHKERR moab.add_entities(meshset, entities);
1443 CHKERR moab.write_file(file_name.c_str(), file_type.c_str(), options.c_str(),
1444 &meshset, 1);
1445 CHKERR moab.delete_entities(&meshset, 1);
1447}
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 1415 of file MeshsetsManager.cpp.

1418 {
1419
1421 MoFEM::Interface &m_field = cOre;
1422 const CubitMeshSets *cubit_meshset_ptr;
1423 CHKERR getCubitMeshsetPtr(ms_id, cubit_bc_type, &cubit_meshset_ptr);
1424 EntityHandle meshset = cubit_meshset_ptr->getMeshset();
1425 CHKERR m_field.get_moab().write_file(file_name.c_str(), file_type.c_str(),
1426 options.c_str(), &meshset, 1);
1428}

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

Definition at line 1450 of file MeshsetsManager.cpp.

1450 {
1452 BitRefManager *bit_mng = cOre.getInterface<BitRefManager>();
1453 for (_IT_CUBITMESHSETS_FOR_LOOP_((*this), iit)) {
1454 EntityHandle meshset = iit->getMeshset();
1455 for (EntityType t = MBVERTEX; t != MBENTITYSET; ++t)
1456 CHKERR bit_mng->updateMeshsetByEntitiesChildren(meshset, bit, meshset, t,
1457 true);
1458 }
1460}
#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: