v0.14.0
Loading...
Searching...
No Matches
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
 
 MeshsetsManager (const MoFEM::Core &core)
 
virtual ~MeshsetsManager ()=default
 
MoFEMErrorCode getTags (int verb=-1)
 get tags handlers used on meshsets More...
 
Tag get_nsTag () const
 get tag handle used to store "id" of NODESET More...
 
Tag get_ssTag () const
 get tag handle used to store "id" of SIDESET More...
 
Tag get_nsTag_data () const
 get tag handle used to store boundary data on NODESET More...
 
Tag get_ssTag_data () const
 get tag handle used to store boundary data on SIDESET More...
 
Tag get_bhTag () const
 get tag handle used to store "id" of BLOCKSET More...
 
Tag get_bhTag_header () const
 get tag handle used to store of block set header (Used by Cubit) More...
 
MeshsetsManagerget_meshsets_manager_ptr ()
 return pointer to meshset manager More...
 
const MeshsetsManagerget_meshsets_manager_ptr () const
 return pointer to meshset manager More...
 
MoFEMErrorCode clearMap ()
 clear multi-index container More...
 
MoFEMErrorCode initialiseDatabaseFromMesh (int verb=DEFAULT_VERBOSITY)
 
MoFEMErrorCode readMeshsets (int verb=DEFAULT_VERBOSITY)
 Boradcats meshsets. More...
 
MoFEMErrorCode broadcastMeshsets (int verb=DEFAULT_VERBOSITY)
 Boradcats meshsets. More...
 
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 data structure More...
 
MoFEMErrorCode printPressureSet () const
 print meshsets with pressure boundary conditions data structure More...
 
MoFEMErrorCode printForceSet () const
 print meshsets with force boundary conditions data structure More...
 
MoFEMErrorCode printTemperatureSet () const
 print meshsets with temperature boundary conditions data structure More...
 
MoFEMErrorCode printHeatFluxSet () const
 print meshsets with heat flux boundary conditions data structure More...
 
MoFEMErrorCode printMaterialsSet () const
 print meshsets with material data structure set on it More...
 
CubitMeshSet_multiIndexgetMeshsetsMultindex ()
 
CubitMeshSet_multiIndex::iterator getBegin () const
 get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT) More...
 
CubitMeshSet_multiIndex::iterator getEnd () const
 get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT) More...
 
CubitMeshsetByType::iterator getBegin (const unsigned int cubit_bc_type) const
 get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT) More...
 
CubitMeshsetByType::iterator getEnd (const unsigned int cubit_bc_type) const
 get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT) More...
 
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) More...
 
CubitMeshsetByMask::iterator getBySetTypeEnd (const unsigned int cubit_bc_type) const
 get end iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT) More...
 
CubitMeshsetByName::iterator getBegin (const std::string &name) const
 get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT) More...
 
CubitMeshsetByName::iterator getEnd (const std::string &name) const
 get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT) More...
 
bool checkMeshset (const int ms_id, const CubitBCType cubit_bc_type) const
 check for CUBIT Id and CUBIT type More...
 
bool checkMeshset (const string name, int *const number_of_meshsets_ptr=NULL) const
 check if meshset of given name exist More...
 
MoFEMErrorCode addMeshset (const CubitBCType cubit_bc_type, const int ms_id, const std::string name="")
 add cubit meshset More...
 
MoFEMErrorCode addEntitiesToMeshset (const CubitBCType cubit_bc_type, const int ms_id, const Range &ents)
 add entities to cubit meshset More...
 
MoFEMErrorCode addEntitiesToMeshset (const CubitBCType cubit_bc_type, const int ms_id, const EntityHandle *ents, const int nb_ents)
 add entities to cubit meshset More...
 
MoFEMErrorCode setAtributes (const CubitBCType cubit_bc_type, const int ms_id, const std::vector< double > &attributes, const std::string name="")
 set attributes to cubit meshset More...
 
MoFEMErrorCode setAtributesByDataStructure (const CubitBCType cubit_bc_type, const int ms_id, const GenericAttributeData &data, const std::string name="")
 set (material) data structure to cubit meshset More...
 
MoFEMErrorCode setBcData (const CubitBCType cubit_bc_type, const int ms_id, const GenericCubitBcData &data)
 set boundary data structure to meshset More...
 
MoFEMErrorCode deleteMeshset (const CubitBCType cubit_bc_type, const int ms_id, const MoFEMTypes bh=MF_EXIST)
 delete cubit meshset More...
 
MoFEMErrorCode getCubitMeshsetPtr (const int ms_id, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr) const
 get cubit meshset More...
 
const CubitMeshSetsgetCubitMeshsetPtr (const int ms_id, const CubitBCType cubit_bc_type) const
 get cubit meshset More...
 
MoFEMErrorCode getCubitMeshsetPtr (const CubitBCType cubit_bc_type, std::vector< const CubitMeshSets * > &vec_ptr) const
 Get vector of pointer by bc type. More...
 
std::vector< const CubitMeshSets * > getCubitMeshsetPtr (const CubitBCType cubit_bc_type) const
 Get vector of pointer by bc type. More...
 
MoFEMErrorCode getCubitMeshsetPtr (const string name, const CubitMeshSets **cubit_meshset_ptr) const
 get cubit meshset More...
 
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. More...
 
std::vector< const CubitMeshSets * > getCubitMeshsetPtr (const std::regex reg_exp_name) const
 Get vector of pointer to blocksets with name satisfying regular expression. More...
 
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 More...
 
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, More...
 
MoFEMErrorCode getMeshset (const int ms_id, const unsigned int cubit_bc_type, EntityHandle &meshset) const
 get meshset from CUBIT Id and CUBIT type More...
 
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. More...
 
MoFEMErrorCode getMeshsetsByType (const unsigned int cubit_bc_type, Range &meshsets) const
 get all CUBIT meshsets by CUBIT type More...
 
MoFEMErrorCode setMeshsetFromFile (const string file_name, const bool clean_file_options=true)
 add blocksets reading config file More...
 
MoFEMErrorCode setMeshsetFromFile ()
 get name of config file from line command '-meshsets_config' More...
 
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 More...
 
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 More...
 
boost::shared_ptr< boost::program_options::options_description > & getConfigFileOptionsPtr ()
 Get config file options, use with care. More...
 
MoFEMErrorCode updateAllMeshsetsByEntitiesChildren (const BitRefLevel &bit)
 Update all blolsets, sidesets and node sets. More...
 
- Public Member Functions inherited from MoFEM::UnknownInterface
virtual MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const =0
 
template<class IFACE >
MoFEMErrorCode registerInterface (bool error_if_registration_failed=true)
 Register interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface refernce to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface. More...
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface. More...
 
virtual ~UnknownInterface ()=default
 

Public Attributes

MoFEM::CorecOre
 

Static Public Attributes

static bool brodcastMeshsets = true
 

Protected Attributes

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

Additional Inherited Members

- Static Public Member Functions inherited from MoFEM::UnknownInterface
static MoFEMErrorCode getLibVersion (Version &version)
 Get library version. More...
 
static MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version)
 Get database major version. More...
 
static MoFEMErrorCode setFileVersion (moab::Interface &moab, Version version=Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD))
 Get database major version. More...
 
static MoFEMErrorCode getInterfaceVersion (Version &version)
 Get database major version. More...
 

Detailed Description

Interface for managing meshsets containing materials and boundary conditions.

Examples
EshelbianPlasticity.cpp, add_blockset.cpp, add_cubit_meshsets.cpp, cell_forces.cpp, cubit_bc_test.cpp, dynamic_first_order_con_law.cpp, elasticity.cpp, elasticity_mixed_formulation.cpp, free_surface.cpp, heat_equation.cpp, mesh_cut.cpp, mesh_smoothing.cpp, meshset_to_vtk.cpp, photon_diffusion.cpp, plastic.cpp, prism_elements_from_surface.cpp, reaction_diffusion.cpp, simple_contact.cpp, split_sideset.cpp, thermo_elastic.cpp, and unsaturated_transport.cpp.

Definition at line 104 of file MeshsetsManager.hpp.

Constructor & Destructor Documentation

◆ MeshsetsManager()

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

Definition at line 23 of file MeshsetsManager.cpp.

24 : cOre(const_cast<Core &>(core)) {
25
26 if (!LogManager::checkIfChannelExist("MeshsetMngWorld")) {
27 auto core_log = logging::core::get();
28
29 core_log->add_sink(
31 core_log->add_sink(
33 core_log->add_sink(
35
36 LogManager::setLog("MeshsetMngWorld");
37 LogManager::setLog("MeshsetMngSync");
38 LogManager::setLog("MeshsetMngSelf");
39
40 MOFEM_LOG_TAG("MeshsetMngWorld", "MeshsetMng");
41 MOFEM_LOG_TAG("MeshsetMngSync", "MeshsetMng");
42 MOFEM_LOG_TAG("MeshsetMngSelf", "MeshsetMng");
43 }
44
45 MOFEM_LOG("MeshsetMngWorld", Sev::noisy) << "Mashset manager created";
46}
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
Definition: LogManager.cpp:389
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:308
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
Definition: LogManager.hpp:339
CoreTmp< 0 > Core
Definition: Core.hpp:1094
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
Definition: LogManager.cpp:298
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
Definition: LogManager.cpp:344
static boost::shared_ptr< std::ostream > getStrmSync()
Get the strm sync object.
Definition: LogManager.cpp:348
static bool checkIfChannelExist(const std::string channel)
Check if channel exist.
Definition: LogManager.cpp:399
static boost::shared_ptr< std::ostream > getStrmSelf()
Get the strm self object.
Definition: LogManager.cpp:340

◆ ~MeshsetsManager()

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

Member Function Documentation

◆ addEntitiesToMeshset() [1/2]

MoFEMErrorCode MoFEM::MeshsetsManager::addEntitiesToMeshset ( const CubitBCType  cubit_bc_type,
const int  ms_id,
const EntityHandle ents,
const int  nb_ents 
)

add entities to cubit meshset

Parameters
cubit_bc_typetype of meshset, f.e. NODESET, SIDESET or BLOCKSET
ms_idid of meshset
entspointer to entities array
nb_entsnumber of entities in array
Returns
error code

Definition at line 365 of file MeshsetsManager.cpp.

367 {
368 Interface &m_field = cOre;
369 moab::Interface &moab = m_field.get_moab();
371 auto cit =
372 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
373 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
374 if (cit ==
375 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
376 SETERRQ1(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
377 "Cannot find Cubit meshset with id: %d", ms_id);
378 }
379 EntityHandle meshset = cit->getMeshset();
380 CHKERR moab.add_entities(meshset, ents, nb_ents);
381
383}
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1975
moab::Interface & get_moab()
Definition: Core.hpp:322
CubitMeshSet_multiIndex cubitMeshsets
cubit meshsets

◆ addEntitiesToMeshset() [2/2]

MoFEMErrorCode MoFEM::MeshsetsManager::addEntitiesToMeshset ( const CubitBCType  cubit_bc_type,
const int  ms_id,
const Range ents 
)

add entities to cubit meshset

Parameters
cubit_bc_typetype of meshset, f.e. NODESET, SIDESET or BLOCKSET
ms_idid of meshset
entsentities to add
Returns
error code
Examples
mesh_cut.cpp.

Definition at line 345 of file MeshsetsManager.cpp.

346 {
347 Interface &m_field = cOre;
348 moab::Interface &moab = m_field.get_moab();
350 auto cit =
351 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
352 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
353 if (cit ==
354 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
355 SETERRQ1(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
356 "Cannot find Cubit meshset with id: %d", ms_id);
357 }
358 EntityHandle meshset = cit->getMeshset();
359 CHKERR moab.add_entities(meshset, ents);
360
362}

◆ broadcastMeshsets()

MoFEMErrorCode MoFEM::MeshsetsManager::broadcastMeshsets ( int  verb = DEFAULT_VERBOSITY)

Boradcats meshsets.

Parameters
verb
Returns
MoFEMErrorCode

Definition at line 105 of file MeshsetsManager.cpp.

105 {
106 Interface &m_field = cOre;
107 moab::Interface &moab = m_field.get_moab();
109
110 ParallelComm *pcomm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
111 if (pcomm == NULL)
112 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
113 "MOAB communicator not set");
114
115 const double coords[] = {0, 0, 0};
116
117 auto set_tags_dummy_node = [&](const EntityHandle dummy_node,
118 const EntityHandle meshset) {
120 std::vector<Tag> tag_handles;
121 CHKERR moab.tag_get_tags_on_entity(meshset, tag_handles);
122 for (auto th : tag_handles) {
123 void *data[1];
124 int tag_size;
125 CHKERR moab.tag_get_by_ptr(th, &meshset, 1, (const void **)data,
126 &tag_size);
127 CHKERR moab.tag_set_by_ptr(th, &dummy_node, 1, data, &tag_size);
128 }
130 };
131
132 for (int from_proc = 0; from_proc < pcomm->size(); ++from_proc) {
133
134 Range r_dummy_nodes;
135
136 if (from_proc == pcomm->rank()) {
137 std::vector<EntityHandle> dummy_nodes(cubitMeshsets.size(), 0);
138 int i = 0;
139 for (auto &m : cubitMeshsets) {
140 CHKERR moab.create_vertex(coords, dummy_nodes[i]);
141 CHKERR set_tags_dummy_node(dummy_nodes[i], m.getMeshset());
142 ++i;
143 }
144 r_dummy_nodes.insert_list(dummy_nodes.begin(), dummy_nodes.end());
145 }
146
147 CHKERR pcomm->broadcast_entities(from_proc, r_dummy_nodes, false, true);
148
149 for (auto dummy_node : r_dummy_nodes) {
151 CHKERR moab.create_meshset(MESHSET_SET, m);
152 CHKERR set_tags_dummy_node(m, dummy_node);
153
154 CubitMeshSets broadcast_block(moab, m);
155 if ((broadcast_block.cubitBcType &
157 .any()) {
158 auto p = cubitMeshsets.insert(broadcast_block);
159 if (!p.second) {
160 CHKERR moab.delete_entities(&m, 1);
161 } else {
162 MOFEM_LOG("MeshsetMngSelf", Sev::noisy)
163 << "broadcast " << broadcast_block;
164 }
165 }
166 }
167
168 CHKERR moab.delete_entities(r_dummy_nodes);
169 }
170
172}
static Index< 'p', 3 > p
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:215
@ NODESET
Definition: definitions.h:146
@ SIDESET
Definition: definitions.h:147
@ BLOCKSET
Definition: definitions.h:148
FTensor::Index< 'm', SPACE_DIM > m
FTensor::Index< 'i', SPACE_DIM > i
std::bitset< 32 > CubitBCType
Definition: Types.hpp:52

◆ 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 660 of file MeshsetsManager.cpp.

662 {
663 auto miit =
664 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
665 boost::make_tuple(ms_id, cubit_bc_type));
666 if (miit !=
667 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
668 Interface &m_field = cOre;
669 return m_field.get_moab().contains_entities(miit->meshset, entities,
670 num_entities, operation_type);
671 } else
672 return false;
673}

◆ checkMeshset()

bool MoFEM::MeshsetsManager::checkMeshset ( const string  name,
int *const  number_of_meshsets_ptr = NULL 
) const

check if meshset of given name exist

Parameters
namename of meshset
Returns
error code

Definition at line 299 of file MeshsetsManager.cpp.

300 {
301 auto miit = cubitMeshsets.get<CubitMeshsets_name>().lower_bound(name);
302 auto hi_miit = cubitMeshsets.get<CubitMeshsets_name>().upper_bound(name);
303 if (std::distance(miit, hi_miit) == 0) {
304 return false;
305 }
306 if (number_of_meshsets_ptr) {
307 *number_of_meshsets_ptr = std::distance(miit, hi_miit);
308 }
309 return true;
310}

◆ clearMap()

MoFEMErrorCode MoFEM::MeshsetsManager::clearMap ( )

clear multi-index container

Returns
error code

Definition at line 48 of file MeshsetsManager.cpp.

48 {
50 cubitMeshsets.clear();
52}
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440

◆ deleteMeshset()

MoFEMErrorCode MoFEM::MeshsetsManager::deleteMeshset ( const CubitBCType  cubit_bc_type,
const int  ms_id,
const MoFEMTypes  bh = MF_EXIST 
)

delete cubit meshset

Parameters
seeCubitBC (NODESET, SIDESET or BLOCKSET and more)
ms_idid of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT

Definition at line 480 of file MeshsetsManager.cpp.

482 {
483 Interface &m_field = cOre;
484 moab::Interface &moab = m_field.get_moab();
486 auto miit =
487 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
488 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
489 if (miit ==
490 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
491 if (bh & MF_EXIST) {
492 SETERRQ1(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
493 "meshset not found", ms_id);
494 } else {
496 }
497 }
498 EntityHandle meshset = miit->getMeshset();
499 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().erase(miit);
500 CHKERR moab.delete_entities(&meshset, 1);
501
503}
@ MF_EXIST
Definition: definitions.h:100

◆ get_bhTag()

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

get tag handle used to store "id" of BLOCKSET

Definition at line 149 of file MeshsetsManager.hpp.

149{ return bhTag; }

◆ 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 154 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 159 of file MeshsetsManager.hpp.

159{ 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 164 of file MeshsetsManager.hpp.

164{ return this; }

◆ get_nsTag()

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

get tag handle used to store "id" of NODESET

Definition at line 129 of file MeshsetsManager.hpp.

129{ return nsTag; }

◆ get_nsTag_data()

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

get tag handle used to store boundary data on NODESET

Definition at line 139 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 134 of file MeshsetsManager.hpp.

134{ return ssTag; }

◆ get_ssTag_data()

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

get tag handle used to store boundary data on SIDESET

Definition at line 144 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 869 of file MeshsetsManager.hpp.

869 {
871 }
boost::shared_ptr< boost::program_options::options_description > configFileOptionsPtr
config file options

◆ getMeshsetsMultindex()

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

Definition at line 229 of file MeshsetsManager.hpp.

229 {
230 return cubitMeshsets;
231 }

◆ getTags()

MoFEMErrorCode MoFEM::MeshsetsManager::getTags ( int  verb = -1)

get tags handlers used on meshsets

On meshsets range of tags in set. Depending on tag type and data on that tag type of meshset could be determined. This function get hanldes to tags.

Most of the tags are followinf convention used by MoAB or Cubit and other meshing softwares, f.e. gmesh.

Definition at line 174 of file MeshsetsManager.cpp.

174 {
176 Interface &m_field = cOre;
177 moab::Interface &moab = m_field.get_moab();
178 int default_val = -1;
179 CHKERR moab.tag_get_handle(DIRICHLET_SET_TAG_NAME, 1, MB_TYPE_INTEGER, nsTag,
180 MB_TAG_SPARSE | MB_TAG_CREAT, &default_val);
181
182 CHKERR moab.tag_get_handle(NEUMANN_SET_TAG_NAME, 1, MB_TYPE_INTEGER, ssTag,
183 MB_TAG_SPARSE | MB_TAG_CREAT, &default_val);
184
185 const int def_bc_data_len = 0;
186 std::string tag_name = std::string(DIRICHLET_SET_TAG_NAME) + "__BC_DATA";
187 CHKERR moab.tag_get_handle(
188 tag_name.c_str(), def_bc_data_len, MB_TYPE_OPAQUE, nsTag_data,
189 MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES | MB_TAG_VARLEN, NULL);
190
191 tag_name = std::string(NEUMANN_SET_TAG_NAME) + "__BC_DATA";
192 CHKERR moab.tag_get_handle(
193 tag_name.c_str(), def_bc_data_len, MB_TYPE_OPAQUE, ssTag_data,
194 MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES | MB_TAG_VARLEN, NULL);
195
196 CHKERR moab.tag_get_handle(MATERIAL_SET_TAG_NAME, 1, MB_TYPE_INTEGER, bhTag,
197 MB_TAG_SPARSE | MB_TAG_CREAT, &default_val);
198
199 std::vector<unsigned int> def_uint_zero(3, 0);
200 CHKERR moab.tag_get_handle(
201 BLOCK_HEADER, 3 * sizeof(unsigned int), MB_TYPE_INTEGER, bhTag_header,
202 MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES, &def_uint_zero[0]);
203
204 Tag block_attribs;
205 int def_Block_Attributes_length = 0;
206 CHKERR moab.tag_get_handle(
207 BLOCK_ATTRIBUTES, def_Block_Attributes_length, MB_TYPE_DOUBLE,
208 block_attribs, MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_VARLEN, NULL);
209
210 Tag entity_name_tag;
211 CHKERR moab.tag_get_handle(NAME_TAG_NAME, NAME_TAG_SIZE, MB_TYPE_OPAQUE,
212 entity_name_tag, MB_TAG_SPARSE | MB_TAG_CREAT);
213
215}

◆ initialiseDatabaseFromMesh()

MoFEMErrorCode MoFEM::MeshsetsManager::initialiseDatabaseFromMesh ( int  verb = DEFAULT_VERBOSITY)

\brier initialize container form data on mesh

Returns
[description]

Definition at line 54 of file MeshsetsManager.cpp.

54 {
55 Interface &m_field = cOre;
57 CHKERR readMeshsets(verb);
60
61 std::vector<const CubitMeshSets *> vec_ptr;
62
63 for (auto &m : cubitMeshsets) {
64 vec_ptr.push_back(&m);
65 }
66 std::sort(vec_ptr.begin(), vec_ptr.end(),
67 [](const CubitMeshSets *a, const CubitMeshSets *b) {
68 return a->getMeshsetId() < b->getMeshsetId();
69 });
70
71 for (auto m_ptr : vec_ptr) {
72 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *m_ptr;
73 }
74 // Verbose synchronised print
75 for (auto m_ptr : vec_ptr) {
76 MOFEM_LOG("MeshsetMngSync", Sev::verbose) << *m_ptr;
77 }
78 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::verbose);
79
81}
#define MOFEM_LOG_SEVERITY_SYNC(comm, severity)
Synchronise "SYNC" on curtain severity level.
Definition: LogManager.hpp:352
MoFEMErrorCode broadcastMeshsets(int verb=DEFAULT_VERBOSITY)
Boradcats meshsets.
MoFEMErrorCode readMeshsets(int verb=DEFAULT_VERBOSITY)
Boradcats meshsets.

◆ printBcSet()

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

Definition at line 899 of file MeshsetsManager.hpp.

900 {
902 const MoFEM::Interface &m_field = cOre;
903 const moab::Interface &moab = m_field.get_moab();
904 for (auto it : getCubitMeshsetPtr(type)) {
905 CHKERR it->getBcDataStructure(data);
906 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *it;
907 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << data;
908 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << "name " << it->getName();
909 for (EntityType t = MBVERTEX; t != MBENTITYSET; ++t) {
910 int nb;
911 CHKERR moab.get_number_entities_by_type(it->meshset, t, nb, true);
912 if (nb > 0) {
913 MOFEM_LOG("MeshsetMngSync", Sev::inform)
914 << "msId " << it->getMeshsetId() << " number of "
915 << moab::CN::EntityTypeName(t) << " " << nb;
916 }
917 }
918 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::inform);
919 }
921}
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:59
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
Deprecated interface functions.

◆ printDisplacementSet()

MoFEMErrorCode MoFEM::MeshsetsManager::printDisplacementSet ( ) const

print meshsets with displacement boundary conditions data structure

Examples
elasticity.cpp, elasticity_mixed_formulation.cpp, and simple_contact.cpp.

Definition at line 217 of file MeshsetsManager.cpp.

217 {
218 DisplacementCubitBcData mydata;
220 CHKERR printBcSet(mydata, NODESET | mydata.tYpe.to_ulong());
222}
MoFEMErrorCode printBcSet(CUBIT_BC_DATA_TYPE &data, unsigned long int type) const

◆ printForceSet()

MoFEMErrorCode MoFEM::MeshsetsManager::printForceSet ( ) const

print meshsets with force boundary conditions data structure

Examples
elasticity.cpp, elasticity_mixed_formulation.cpp, and simple_contact.cpp.

Definition at line 231 of file MeshsetsManager.cpp.

231 {
232 ForceCubitBcData mydata;
234 CHKERR printBcSet(mydata, NODESET | mydata.tYpe.to_ulong());
236}

◆ printHeatFluxSet()

MoFEMErrorCode MoFEM::MeshsetsManager::printHeatFluxSet ( ) const

print meshsets with heat flux boundary conditions data structure

Definition at line 245 of file MeshsetsManager.cpp.

245 {
246 HeatFluxCubitBcData mydata;
248 CHKERR printBcSet(mydata, SIDESET | mydata.tYpe.to_ulong());
250}

◆ printMaterialsSet()

MoFEMErrorCode MoFEM::MeshsetsManager::printMaterialsSet ( ) const

print meshsets with material data structure set on it

Examples
elasticity.cpp, elasticity_mixed_formulation.cpp, and simple_contact.cpp.

Definition at line 252 of file MeshsetsManager.cpp.

252 {
254 const Interface &m_field = cOre;
255 const moab::Interface &moab = m_field.get_moab();
257 (*this), BLOCKSET | MAT_ELASTICSET, it)) {
258 Mat_Elastic data;
259 CHKERR it->getAttributeDataStructure(data);
260 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *it;
261 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << data;
262 Range tets;
263 CHKERR moab.get_entities_by_dimension(it->meshset, 3, tets, true);
264 MOFEM_LOG("MeshsetMngWorld", Sev::inform)
265 << "MAT_ELATIC msId " << it->getMeshsetId() << " nb. volumes "
266 << tets.size();
267 }
268
270 m_field, BLOCKSET | MAT_THERMALSET, it)) {
271 Mat_Thermal data;
272 CHKERR it->getAttributeDataStructure(data);
273 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *it;
274 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << data;
275 }
276
278 m_field, BLOCKSET | MAT_MOISTURESET, it)) {
279 Mat_Moisture data;
280 CHKERR it->getAttributeDataStructure(data);
281 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *it;
282 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << data;
283 }
285}
@ MAT_ELASTICSET
block name is "MAT_ELASTIC"
Definition: definitions.h:159
@ MAT_THERMALSET
block name is "MAT_THERMAL"
Definition: definitions.h:161
@ MAT_MOISTURESET
block name is "MAT_MOISTURE"
Definition: definitions.h:163
#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet in a moFEM field.

◆ printPressureSet()

MoFEMErrorCode MoFEM::MeshsetsManager::printPressureSet ( ) const

print meshsets with pressure boundary conditions data structure

Definition at line 224 of file MeshsetsManager.cpp.

224 {
225 PressureCubitBcData mydata;
227 CHKERR printBcSet(mydata, SIDESET | mydata.tYpe.to_ulong());
229}

◆ printTemperatureSet()

MoFEMErrorCode MoFEM::MeshsetsManager::printTemperatureSet ( ) const

print meshsets with temperature boundary conditions data structure

Definition at line 238 of file MeshsetsManager.cpp.

238 {
239 TemperatureCubitBcData mydata;
241 CHKERR printBcSet(mydata, NODESET | mydata.tYpe.to_ulong());
243}

◆ query_interface()

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

Implements MoFEM::UnknownInterface.

Definition at line 17 of file MeshsetsManager.cpp.

18 {
19 *iface = const_cast<MeshsetsManager *>(this);
20 return 0;
21}
MeshsetsManager(const MoFEM::Core &core)

◆ readMeshsets()

MoFEMErrorCode MoFEM::MeshsetsManager::readMeshsets ( int  verb = DEFAULT_VERBOSITY)

Boradcats meshsets.

Parameters
verb
Returns
MoFEMErrorCode

Definition at line 83 of file MeshsetsManager.cpp.

83 {
84 Interface &m_field = cOre;
85 moab::Interface &moab = m_field.get_moab();
87
88 Range meshsets;
89 CHKERR moab.get_entities_by_type(0, MBENTITYSET, meshsets, false);
90 for (auto m : meshsets) {
91 // check if meshset is cubit meshset
92 CubitMeshSets block(moab, m);
93 if ((block.cubitBcType & CubitBCType(NODESET | SIDESET | BLOCKSET)).any()) {
94 auto p = cubitMeshsets.insert(block);
95 if (!p.second)
96 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
97 "meshset not inserted");
98 MOFEM_LOG("MeshsetMngSelf", Sev::noisy) << "read " << block;
99 }
100 }
101
103}

◆ 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 1348 of file MeshsetsManager.cpp.

1351 {
1352
1354 MoFEM::Interface &m_field = cOre;
1355 moab::Interface &moab = m_field.get_moab();
1356 Range entities;
1357 CHKERR getEntitiesByDimension(ms_id, cubit_bc_type, dim, entities, recursive);
1358 EntityHandle meshset;
1359 CHKERR moab.create_meshset(MESHSET_SET, meshset);
1360 CHKERR moab.add_entities(meshset, entities);
1361 CHKERR moab.write_file(file_name.c_str(), file_type.c_str(), options.c_str(),
1362 &meshset, 1);
1363 CHKERR moab.delete_entities(&meshset, 1);
1365}
const int dim
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
meshset_to_vtk.cpp.

Definition at line 1333 of file MeshsetsManager.cpp.

1336 {
1337
1339 MoFEM::Interface &m_field = cOre;
1340 const CubitMeshSets *cubit_meshset_ptr;
1341 CHKERR getCubitMeshsetPtr(ms_id, cubit_bc_type, &cubit_meshset_ptr);
1342 EntityHandle meshset = cubit_meshset_ptr->getMeshset();
1343 CHKERR m_field.get_moab().write_file(file_name.c_str(), file_type.c_str(),
1344 options.c_str(), &meshset, 1);
1346}

◆ setAtributes()

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

set attributes to cubit meshset

Parameters
cubit_bc_typetype of meshset, see CubitBC, i.e. BLOCKSET, NODESET, SIDESET
ms_idid of meshset
attributesattributes
nameset name to blockset
Returns
error code
Examples
add_cubit_meshsets.cpp.

Definition at line 386 of file MeshsetsManager.cpp.

388 {
389 Interface &m_field = cOre;
390 moab::Interface &moab = m_field.get_moab();
392 auto cit =
393 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
394 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
395 if (cit ==
396 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
397 SETERRQ1(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
398 "Cannot find Cubit meshset with id: %d", ms_id);
399 }
400 if (name.size() > 0) {
401 bool success = cubitMeshsets.modify(cubitMeshsets.project<0>(cit),
402 CubitMeshSets_change_name(moab, name));
403 if (!success) {
404 SETERRQ(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
405 "name to cubit meshset can not be set");
406 }
407 }
408 bool success =
409 cubitMeshsets.modify(cubitMeshsets.project<0>(cit),
410 CubitMeshSets_change_attributes(moab, attributes));
411 if (!success)
412 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
413 "modification unsuccessful");
414
415 std::ostringstream ss;
416 ss << "Block " << cit->getName();
417 ss << " Add attr: ";
418 for (unsigned int ii = 0; ii != attributes.size(); ii++) {
419 ss << attributes[ii] << " ";
420 }
421 MOFEM_LOG("MeshsetMngSelf", Sev::noisy) << ss.str();
422
424}
@ MOFEM_OPERATION_UNSUCCESSFUL
Definition: definitions.h:34

◆ setAtributesByDataStructure()

MoFEMErrorCode MoFEM::MeshsetsManager::setAtributesByDataStructure ( const CubitBCType  cubit_bc_type,
const int  ms_id,
const GenericAttributeData data,
const std::string  name = "" 
)

set (material) data structure to cubit meshset

Parameters
cubit_bc_typetype of meshset, see CubitBC, i.e. BLOCKSET, NODESET, SIDESET
ms_idid of meshset
attributesattributes
Returns
error code
Examples
add_cubit_meshsets.cpp.

Definition at line 426 of file MeshsetsManager.cpp.

428 {
429 Interface &m_field = cOre;
430 moab::Interface &moab = m_field.get_moab();
432 auto cit =
433 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
434 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
435 if (cit ==
436 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
437 SETERRQ1(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
438 "Cannot find Cubit meshset with id: %d", ms_id);
439 }
440 if (name.size() > 0) {
441 bool success = cubitMeshsets.modify(cubitMeshsets.project<0>(cit),
442 CubitMeshSets_change_name(moab, name));
443 if (!success) {
444 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
445 "name to cubit meshset can not be set");
446 }
447 }
448 bool success = cubitMeshsets.modify(
449 cubitMeshsets.project<0>(cit),
450 CubitMeshSets_change_attributes_data_structure(moab, data));
451 if (!success)
452 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
453 "modification unsuccessful");
455}

◆ setBcData()

MoFEMErrorCode MoFEM::MeshsetsManager::setBcData ( const CubitBCType  cubit_bc_type,
const int  ms_id,
const GenericCubitBcData data 
)

set boundary data structure to meshset

Parameters
cubit_bc_typetype of meshset, see CubitBC, i.e. BLOCKSET, NODESET, SIDESET
ms_idid of meshset
datadata structure
Returns
error code
Examples
add_cubit_meshsets.cpp.

Definition at line 457 of file MeshsetsManager.cpp.

459 {
460 Interface &m_field = cOre;
461 moab::Interface &moab = m_field.get_moab();
463 auto cit =
464 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
465 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
466 if (cit ==
467 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
468 SETERRQ1(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
469 "Cubit meshset with id is already there", ms_id);
470 }
471 bool success =
472 cubitMeshsets.modify(cubitMeshsets.project<0>(cit),
473 CubitMeshSets_change_bc_data_structure(moab, data));
474 if (!success)
475 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
476 "modification unsuccessful");
478}

◆ setMeshsetFromFile() [1/2]

MoFEMErrorCode MoFEM::MeshsetsManager::setMeshsetFromFile ( )

get name of config file from line command '-meshsets_config'

Returns
error code

Option is "-meshsets_config file_name.cfg"

Definition at line 1309 of file MeshsetsManager.cpp.

1309 {
1310 Interface &m_field = cOre;
1311 PetscBool flg_file;
1312 char meshset_file_name[255] = "config_file.cfg";
1314 CHKERR PetscOptionsBegin(m_field.get_comm(), "", "Set meshsets form file",
1315 "none");
1316 CHKERR PetscOptionsString("-meshsets_config", "meshsets config file name",
1317 "", "add_cubit_meshsets.in", meshset_file_name, 255,
1318 &flg_file);
1319 if (flg_file == PETSC_TRUE) {
1320 ifstream f(meshset_file_name);
1321 if (!f.good()) {
1322 SETERRQ1(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
1323 "File configuring meshsets ( %s ) can not be open\n",
1324 meshset_file_name);
1325 }
1326 CHKERR setMeshsetFromFile(string(meshset_file_name));
1327 }
1328 ierr = PetscOptionsEnd();
1329 CHKERRG(ierr);
1331}
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:483
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:76
MoFEMErrorCode setMeshsetFromFile()
get name of config file from line command '-meshsets_config'

◆ setMeshsetFromFile() [2/2]

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
constexpr AssemblyType A
const int N
Definition: speed_test.cpp:3
Parameters
file_nameconfig file
Returns
error code
Examples
add_cubit_meshsets.cpp, meshset_to_vtk.cpp, and unsaturated_transport.cpp.

Definition at line 725 of file MeshsetsManager.cpp.

726 {
727 Interface &m_field = cOre;
729 std::ifstream ini_file(file_name.c_str(), std::ifstream::in);
730 po::variables_map vm;
731 if (clean_file_options) {
733 boost::shared_ptr<boost::program_options::options_description>(
734 new po::options_description());
735 }
736
737 auto add_block_attributes = [&](auto prefix, auto &block_lists, auto &it) {
738 // remove spacec from blockset name
739 configFileOptionsPtr->add_options()(
740 (prefix + ".number_of_attributes").c_str(),
741 po::value<int>(&block_lists[it->getMeshsetId()].numberOfAttributes)
742 ->default_value(-1),
743 "Number of blockset attribute");
744 for (int ii = 1; ii <= 10; ii++) {
745 std::string surfix = ".user" + boost::lexical_cast<std::string>(ii);
746 configFileOptionsPtr->add_options()(
747 (prefix + surfix).c_str(),
748 po::value<double>(&block_lists[it->getMeshsetId()].aTtr[ii - 1])
749 ->default_value(0.0),
750 "Add block attribute");
751 }
752 };
753
754 // Add blocks
755 map<int, BlockData> block_lists;
757 block_lists[it->getMeshsetId()].cubitMeshset = it->getMeshset();
758 std::string prefix =
759 "block_" + boost::lexical_cast<std::string>(it->getMeshsetId());
760 configFileOptionsPtr->add_options()(
761 (prefix + ".add").c_str(),
762 po::value<string>(&block_lists[it->getMeshsetId()].addType)
763 ->default_value("UNKNOWNSET"),
764 "Add block set")(
765 (prefix + ".id").c_str(),
766 po::value<int>(&block_lists[it->getMeshsetId()].iD)->default_value(-1),
767 "Id of meshset")(
768 (prefix + ".name").c_str(),
769 po::value<string>(&block_lists[it->getMeshsetId()].nAme)
770 ->default_value(""),
771 "Name of the meshset");
772
773 // Block attributes
774 add_block_attributes(prefix, block_lists, it);
775
776 // Mat elastic
777 {
778 // double Young; ///< Young's modulus
779 // double Poisson; ///< Poisson's ratio
780 // double ThermalExpansion; ///< Thermal expansion
781 configFileOptionsPtr->add_options()(
782 (prefix + ".young").c_str(),
783 po::value<double>(
784 &block_lists[it->getMeshsetId()].matElastic.data.Young)
785 ->default_value(-1),
786 "Young modulus")(
787 (prefix + ".poisson").c_str(),
788 po::value<double>(
789 &block_lists[it->getMeshsetId()].matElastic.data.Poisson)
790 ->default_value(-2),
791 "Poisson ratio")(
792 (prefix + ".thermalexpansion").c_str(),
793 po::value<double>(
794 &block_lists[it->getMeshsetId()].matElastic.data.ThermalExpansion)
795 ->default_value(-1),
796 "Thermal expansion");
797 // TODO Add users parameters
798 }
799 // Mat Trans Iso
800 {
801 // Young's modulus in xy plane (Ep)
802 // Young's modulus in z-direction (Ez)
803 // Poisson's ratio in xy plane (vp)
804 // Poisson's ratio in z-direction (vpz)
805 // Shear modulus in z-direction (Gzp)
806 configFileOptionsPtr->add_options()(
807 (prefix + ".Youngp").c_str(),
808 po::value<double>(
809 &block_lists[it->getMeshsetId()].matTransIso.data.Youngp)
810 ->default_value(-1),
811 "Youngp")(
812 (prefix + ".Youngz").c_str(),
813 po::value<double>(
814 &block_lists[it->getMeshsetId()].matTransIso.data.Youngz)
815 ->default_value(-1),
816 "Youngz")(
817 (prefix + ".Poissonp").c_str(),
818 po::value<double>(
819 &block_lists[it->getMeshsetId()].matTransIso.data.Poissonp)
820 ->default_value(0),
821 "Poissonp")(
822 (prefix + ".Poissonpz").c_str(),
823 po::value<double>(
824 &block_lists[it->getMeshsetId()].matTransIso.data.Poissonpz)
825 ->default_value(0),
826 "Poissonpz")(
827 (prefix + ".Shearzp").c_str(),
828 po::value<double>(
829 &block_lists[it->getMeshsetId()].matTransIso.data.Shearzp)
830 ->default_value(-1),
831 "Shearzp");
832 // TODO Add users parameters
833 }
834 // Mat thermal
835 {
836 // double Conductivity; ///< Thermal conductivity
837 // double HeatCapacity; ///< Heat Capacity
838 configFileOptionsPtr->add_options()(
839 (prefix + ".conductivity").c_str(),
840 po::value<double>(
841 &block_lists[it->getMeshsetId()].matThermal.data.Conductivity)
842 ->default_value(-1),
843 "Conductivity")(
844 (prefix + ".capacity").c_str(),
845 po::value<double>(
846 &block_lists[it->getMeshsetId()].matThermal.data.HeatCapacity)
847 ->default_value(-1),
848 "Capacity");
849 // TODO Add users parameters
850 }
851 // Mat interface
852 {
853 // double alpha; ///< Elastic modulus multiplier
854 // double beta; ///< Damage Coupling multiplier between normal and
855 // shear (g=sqrt(gn^2 + beta(gt1^2 + gt2^2))) double ft; ///< Maximum
856 // stress of crack double Gf; ///< Fracture Energy
857 configFileOptionsPtr->add_options()(
858 (prefix + ".interface_alpha").c_str(),
859 po::value<double>(
860 &block_lists[it->getMeshsetId()].matInterf.data.alpha)
861 ->default_value(-1),
862 "alpha")((prefix + ".interface_beta").c_str(),
863 po::value<double>(
864 &block_lists[it->getMeshsetId()].matInterf.data.beta)
865 ->default_value(-1),
866 "beta")(
867 (prefix + ".interface_ft").c_str(),
868 po::value<double>(&block_lists[it->getMeshsetId()].matInterf.data.ft)
869 ->default_value(-1),
870 "ft")(
871 (prefix + ".interface_Gf").c_str(),
872 po::value<double>(&block_lists[it->getMeshsetId()].matInterf.data.Gf)
873 ->default_value(-1),
874 "Gf");
875 // TODO Add users parameters
876 }
877
878 // Displacement bc
879 {
880 // char flag1; //< Flag for X-Translation (0: N/A, 1: specified)
881 // char flag2; //< Flag for Y-Translation (0: N/A, 1: specified)
882 // char flag3; //< Flag for Z-Translation (0: N/A, 1: specified)
883 // char flag4; //< Flag for X-Rotation (0: N/A, 1: specified)
884 // char flag5; //< Flag for Y-Rotation (0: N/A, 1: specified)
885 // char flag6; //< Flag for Z-Rotation (0: N/A, 1: specified)
886 // double value1; //< Value for X-Translation
887 // double value2; //< Value for Y-Translation
888 // double value3; //< Value for Z-Translation
889 // double value4; //< Value for X-Rotation
890 // double value5; //< Value for Y-Rotation
891 // double value6; //< Value for Z-Rotation
892 configFileOptionsPtr->add_options()(
893 (prefix + ".disp_flag1").c_str(),
894 po::value<char>(&block_lists[it->getMeshsetId()].dispBc.data.flag1)
895 ->default_value(0),
896 "flag1")(
897 (prefix + ".disp_flag2").c_str(),
898 po::value<char>(&block_lists[it->getMeshsetId()].dispBc.data.flag2)
899 ->default_value(0),
900 "flag2")(
901 (prefix + ".disp_flag3").c_str(),
902 po::value<char>(&block_lists[it->getMeshsetId()].dispBc.data.flag3)
903 ->default_value(0),
904 "flag3")(
905 (prefix + ".disp_flag4").c_str(),
906 po::value<char>(&block_lists[it->getMeshsetId()].dispBc.data.flag4)
907 ->default_value(0),
908 "flag4")(
909 (prefix + ".disp_flag5").c_str(),
910 po::value<char>(&block_lists[it->getMeshsetId()].dispBc.data.flag5)
911 ->default_value(0),
912 "flag5")(
913 (prefix + ".disp_flag6").c_str(),
914 po::value<char>(&block_lists[it->getMeshsetId()].dispBc.data.flag6)
915 ->default_value(0),
916 "flag6")(
917 (prefix + ".disp_ux").c_str(),
918 po::value<double>(&block_lists[it->getMeshsetId()].dispBc.data.value1)
919 ->default_value(0),
920 "value1")(
921 (prefix + ".disp_uy").c_str(),
922 po::value<double>(&block_lists[it->getMeshsetId()].dispBc.data.value2)
923 ->default_value(0),
924 "value2")(
925 (prefix + ".disp_uz").c_str(),
926 po::value<double>(&block_lists[it->getMeshsetId()].dispBc.data.value3)
927 ->default_value(0),
928 "value3")(
929 (prefix + ".disp_rx").c_str(),
930 po::value<double>(&block_lists[it->getMeshsetId()].dispBc.data.value4)
931 ->default_value(0),
932 "value4")(
933 (prefix + ".disp_ry").c_str(),
934 po::value<double>(&block_lists[it->getMeshsetId()].dispBc.data.value5)
935 ->default_value(0),
936 "value5")(
937 (prefix + ".disp_rz").c_str(),
938 po::value<double>(&block_lists[it->getMeshsetId()].dispBc.data.value6)
939 ->default_value(0),
940 "value6");
941 }
942 // Force BC data
943 {
944 // char zero[3]; //< 3 zeros
945 // double value1; //< Force magnitude
946 // double value2; //< Moment magnitude
947 // double value3; //< X-component of force direction vector
948 // double value4; //< Y-component of force direction vector
949 // double value5; //< Z-component of force direction vector
950 // double value6; //< X-component of moment direction vector
951 // double value7; //< Y-component of moment direction vector
952 // double value8; //< Z-component of moment direction vector
953 // char zero2; // 0
954 configFileOptionsPtr->add_options()(
955 (prefix + ".force_magnitude").c_str(),
956 po::value<double>(
957 &block_lists[it->getMeshsetId()].forceBc.data.value1)
958 ->default_value(0),
959 "value1")((prefix + ".moment_magnitude").c_str(),
960 po::value<double>(
961 &block_lists[it->getMeshsetId()].forceBc.data.value2)
962 ->default_value(0),
963 "value2")(
964 (prefix + ".force_fx").c_str(),
965 po::value<double>(
966 &block_lists[it->getMeshsetId()].forceBc.data.value3)
967 ->default_value(0),
968 "value3")((prefix + ".force_fy").c_str(),
969 po::value<double>(
970 &block_lists[it->getMeshsetId()].forceBc.data.value4)
971 ->default_value(0),
972 "value4")(
973 (prefix + ".force_fz").c_str(),
974 po::value<double>(
975 &block_lists[it->getMeshsetId()].forceBc.data.value5)
976 ->default_value(0),
977 "value5")((prefix + ".moment_mx").c_str(),
978 po::value<double>(
979 &block_lists[it->getMeshsetId()].forceBc.data.value6)
980 ->default_value(0),
981 "value6")(
982 (prefix + ".moment_my").c_str(),
983 po::value<double>(
984 &block_lists[it->getMeshsetId()].forceBc.data.value7)
985 ->default_value(0),
986 "value7")((prefix + ".moment_mz").c_str(),
987 po::value<double>(
988 &block_lists[it->getMeshsetId()].forceBc.data.value8)
989 ->default_value(0),
990 "value8");
991 }
992 {
993 // char name[11]; //< 11 characters for "Temperature"
994 // char pre1; //< This is always zero
995 // char pre2; //< 0: temperature is not applied on thin shells
996 // (default); 1: temperature is applied on thin shells char flag1; //<
997 // 0: N/A, 1: temperature value applied (not on thin shells) char flag2;
998 // //< 0: N/A, 1: temperature applied on thin shell middle char flag3;
999 // //< 0: N/A, 1: thin shell temperature gradient specified char flag4;
1000 // //< 0: N/A, 1: top thin shell temperature char flag5; //< 0: N/A, 1:
1001 // bottom thin shell temperature char flag6; //< This is always zero
1002 // double value1; //< Temperature (default case - no thin shells)
1003 // double value2; //< Temperature for middle of thin shells
1004 // double value3; //< Temperature gradient for thin shells
1005 // double value4; //< Temperature for top of thin shells
1006 // double value5; //< Temperature for bottom of thin shells
1007 // double value6; //< This is always zero, i.e. ignore
1008 configFileOptionsPtr->add_options()(
1009 (prefix + ".temperature_flag1").c_str(),
1010 po::value<char>(
1011 &block_lists[it->getMeshsetId()].temperatureBc.data.flag1)
1012 ->default_value(0),
1013 "flag1")(
1014 (prefix + ".temperature_t").c_str(),
1015 po::value<double>(
1016 &block_lists[it->getMeshsetId()].temperatureBc.data.value1)
1017 ->default_value(0),
1018 "value1");
1019 // TODO: Add more cases, see above
1020 }
1021 // Sideset
1022 {
1023 // char name[8]; //< 8 characters for "Pressure"
1024 // char zero; //< This is always zero
1025 // char flag2; //< 0: Pressure is interpreted as pure pressure 1:
1026 // pressure is interpreted as total force double value1; //< Pressure
1027 // value
1028 configFileOptionsPtr->add_options()(
1029 (prefix + ".pressure_flag2").c_str(),
1030 po::value<char>(
1031 &block_lists[it->getMeshsetId()].pressureBc.data.flag2)
1032 ->default_value(0),
1033 "flag2")((prefix + ".pressure_magnitude").c_str(),
1034 po::value<double>(
1035 &block_lists[it->getMeshsetId()].pressureBc.data.value1)
1036 ->default_value(0),
1037 "value1");
1038 }
1039 {
1040 // char name[8]; //< 8 characters for "HeatFlux" (no space)
1041 // char pre1; //< This is always zero
1042 // char pre2; //< 0: heat flux is not applied on thin shells (default);
1043 // 1: heat flux is applied on thin shells char flag1; //< 0: N/A, 1:
1044 // normal heat flux case (i.e. single value, case without thin shells)
1045 // char flag2; //< 0: N/A, 1: Thin shell top heat flux specified
1046 // char flag3; //< 0: N/A, 1: Thin shell bottom heat flux specidied
1047 // double value1; //< Heat flux value for default case (no thin shells)
1048 // double value2; //< Heat flux (thin shell top)
1049 // double value3; //< Heat flux (thin shell bottom)
1050 configFileOptionsPtr->add_options()(
1051 (prefix + ".heatflux_flag1").c_str(),
1052 po::value<char>(
1053 &block_lists[it->getMeshsetId()].heatFluxBc.data.flag1)
1054 ->default_value(0),
1055 "flag1")((prefix + ".heatflux_magnitude").c_str(),
1056 po::value<double>(
1057 &block_lists[it->getMeshsetId()].heatFluxBc.data.value1)
1058 ->default_value(0),
1059 "value1");
1060 }
1061 // Interface set
1062 {
1063 configFileOptionsPtr->add_options()(
1064 (prefix + ".interface_type").c_str(),
1065 po::value<char>(&block_lists[it->getMeshsetId()].cfgBc.data.type)
1066 ->default_value(0),
1067 "type");
1068 }
1069 }
1070
1071 map<int, BlockData> block_set_attributes;
1073 block_set_attributes[it->getMeshsetId()].cubitMeshset = it->getMeshset();
1074 block_set_attributes[it->getMeshsetId()].iD = it->getMeshsetId();
1075 block_set_attributes[it->getMeshsetId()].bcType = BLOCKSET;
1076 std::string block_name = it->getName();
1077 block_name.erase(
1078 std::remove_if(block_name.begin(), block_name.end(), ::isspace),
1079 block_name.end());
1080 block_set_attributes[it->getMeshsetId()].nAme = block_name;
1081 // Only blocks which have name
1082 if (block_name.compare("NoNameSet") != 0) {
1083 std::string prefix = "SET_ATTR_" + block_name;
1084 // Block attributes
1085 add_block_attributes(prefix, block_set_attributes, it);
1086 }
1087 }
1088
1089 po::parsed_options parsed =
1090 parse_config_file(ini_file, *configFileOptionsPtr, true);
1091 store(parsed, vm);
1092 po::notify(vm);
1093
1094 // Set type from name
1096
1097 CubitBCType bc_type;
1098 unsigned jj = 0;
1099 while (1 << jj != LASTSET_BC) {
1100 if (string(CubitBCNames[jj + 1]) ==
1101 block_lists[it->getMeshsetId()].addType) {
1102 bc_type = 1 << jj;
1103 }
1104 ++jj;
1105 }
1106 if (bc_type.none()) {
1107 block_lists[it->getMeshsetId()].bcType = UNKNOWNSET;
1108 // Skip the bockset nothing is defined for it
1109 continue;
1110 }
1111
1112 if (bc_type.to_ulong() == BLOCKSET)
1113 block_lists[it->getMeshsetId()].bcType = BLOCKSET;
1114 else if (bc_type.to_ulong() == NODESET)
1115 block_lists[it->getMeshsetId()].bcType = NODESET;
1116 else if (bc_type.to_ulong() == SIDESET)
1117 block_lists[it->getMeshsetId()].bcType = SIDESET;
1118 else {
1119 SETERRQ1(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
1120 "Not yet implemented type %s\n",
1121 block_lists[it->getMeshsetId()].addType.c_str());
1122 }
1123 if (block_lists[it->getMeshsetId()].iD == -1) {
1124 SETERRQ1(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
1125 "Unset iD number %d\n", block_lists[it->getMeshsetId()].iD);
1126 }
1127 }
1128
1129 std::vector<std::string> additional_parameters;
1130 additional_parameters =
1131 collect_unrecognized(parsed.options, po::include_positional);
1132 for (std::vector<std::string>::iterator vit = additional_parameters.begin();
1133 vit != additional_parameters.end(); vit++) {
1134 MOFEM_LOG_C("MeshsetMngSelf", Sev::warning, "Unrecognized option %s",
1135 vit->c_str());
1136 }
1137 for (map<int, BlockData>::iterator mit = block_lists.begin();
1138 mit != block_lists.end(); mit++) {
1139 CubitMeshSet_multiIndex::iterator cubit_meshset_it =
1140 cubitMeshsets.find(mit->second.cubitMeshset);
1141 if (cubit_meshset_it == cubitMeshsets.end()) {
1142 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
1143 "Data inconsistency\n");
1144 }
1145 switch (mit->second.bcType) {
1146 case UNKNOWNSET:
1147 break;
1148 case BLOCKSET: {
1149 if ((CubitBCType(mit->second.bcType) & cubit_meshset_it->getBcType())
1150 .any() &&
1151 mit->second.iD == cubit_meshset_it->getMeshsetId()) {
1152 // Meshset is the same, only modification
1153 } else {
1154 CHKERR addMeshset(mit->second.bcType, mit->second.iD, mit->second.nAme);
1155 EntityHandle meshset = cubit_meshset_it->getMeshset();
1156 CHKERR addEntitiesToMeshset(mit->second.bcType, mit->second.iD,
1157 &meshset, 1);
1158 }
1159 // Add attributes
1160 CHKERR setAtributes(mit->second.bcType, mit->second.iD, mit->second.aTtr);
1161 // Add material elastic data if value are physical (i.e. Young > 0,
1162 // Poisson in (-1.0.5) and ThermalExpansion>0)
1163 if (mit->second.matElastic.data.Young != -1) {
1164 CHKERR setAtributesByDataStructure(mit->second.bcType, mit->second.iD,
1165 mit->second.matElastic);
1166 }
1167 if (mit->second.matTransIso.data.Youngp != -1) {
1168 CHKERR setAtributesByDataStructure(mit->second.bcType, mit->second.iD,
1169 mit->second.matTransIso);
1170 }
1171 if (mit->second.matThermal.data.Conductivity != -1) {
1172 CHKERR setAtributesByDataStructure(mit->second.bcType, mit->second.iD,
1173 mit->second.matThermal);
1174 }
1175 if (mit->second.matInterf.data.ft != -1) {
1176 CHKERR setAtributesByDataStructure(mit->second.bcType, mit->second.iD,
1177 mit->second.matInterf);
1178 }
1179 } break;
1180 case NODESET: {
1181 if ((CubitBCType(mit->second.bcType) & cubit_meshset_it->getBcType())
1182 .any() &&
1183 mit->second.iD == cubit_meshset_it->getMeshsetId()) {
1184 // Meshset is the same, only modification
1185 } else {
1186 CHKERR addMeshset(mit->second.bcType, mit->second.iD);
1187 EntityHandle meshset = cubit_meshset_it->getMeshset();
1188 CHKERR addEntitiesToMeshset(mit->second.bcType, mit->second.iD,
1189 &meshset, 1);
1190 }
1191 // Add displacement bc
1192 if (mit->second.dispBc.data.flag1 || mit->second.dispBc.data.flag2 ||
1193 mit->second.dispBc.data.flag3 || mit->second.dispBc.data.flag4 ||
1194 mit->second.dispBc.data.flag5 || mit->second.dispBc.data.flag6) {
1195 if (mit->second.dispBc.data.flag1 == '0')
1196 mit->second.dispBc.data.flag1 = 0;
1197 if (mit->second.dispBc.data.flag1 == 'N')
1198 mit->second.dispBc.data.flag1 = 0;
1199 if (mit->second.dispBc.data.flag1)
1200 mit->second.dispBc.data.flag1 = 1;
1201 if (mit->second.dispBc.data.flag2 == '0')
1202 mit->second.dispBc.data.flag2 = 0;
1203 if (mit->second.dispBc.data.flag2 == 'N')
1204 mit->second.dispBc.data.flag2 = 0;
1205 if (mit->second.dispBc.data.flag2)
1206 mit->second.dispBc.data.flag2 = 1;
1207 if (mit->second.dispBc.data.flag3 == '0')
1208 mit->second.dispBc.data.flag3 = 0;
1209 if (mit->second.dispBc.data.flag3 == 'N')
1210 mit->second.dispBc.data.flag3 = 0;
1211 if (mit->second.dispBc.data.flag3)
1212 mit->second.dispBc.data.flag3 = 1;
1213 if (mit->second.dispBc.data.flag4 == '0')
1214 mit->second.dispBc.data.flag4 = 0;
1215 if (mit->second.dispBc.data.flag4 == 'N')
1216 mit->second.dispBc.data.flag4 = 0;
1217 if (mit->second.dispBc.data.flag4)
1218 mit->second.dispBc.data.flag4 = 1;
1219 if (mit->second.dispBc.data.flag5 == '0')
1220 mit->second.dispBc.data.flag5 = 0;
1221 if (mit->second.dispBc.data.flag5 == 'N')
1222 mit->second.dispBc.data.flag5 = 0;
1223 if (mit->second.dispBc.data.flag5)
1224 mit->second.dispBc.data.flag5 = 1;
1225 if (mit->second.dispBc.data.flag6 == '0')
1226 mit->second.dispBc.data.flag6 = 0;
1227 if (mit->second.dispBc.data.flag6 == 'N')
1228 mit->second.dispBc.data.flag6 = 0;
1229 if (mit->second.dispBc.data.flag6)
1230 mit->second.dispBc.data.flag6 = 1;
1231 CHKERR setBcData(mit->second.bcType, mit->second.iD,
1232 mit->second.dispBc);
1233 }
1234 if (mit->second.forceBc.data.value1 != 0 ||
1235 mit->second.forceBc.data.value2 != 0) {
1236 CHKERR setBcData(mit->second.bcType, mit->second.iD,
1237 mit->second.forceBc);
1238 }
1239 // Add temperature boundary condition
1240 if (mit->second.temperatureBc.data.flag1) {
1241 if (mit->second.temperatureBc.data.flag1 == '0')
1242 mit->second.temperatureBc.data.flag1 = 0;
1243 if (mit->second.temperatureBc.data.flag1 == 'N')
1244 mit->second.temperatureBc.data.flag1 = 0;
1245 if (mit->second.temperatureBc.data.flag1)
1246 mit->second.temperatureBc.data.flag1 = 1;
1247 CHKERR setBcData(mit->second.bcType, mit->second.iD,
1248 mit->second.temperatureBc);
1249 }
1250 } break;
1251 case SIDESET: {
1252 if ((CubitBCType(mit->second.bcType) & cubit_meshset_it->getBcType())
1253 .any() &&
1254 mit->second.iD == cubit_meshset_it->getMeshsetId()) {
1255 // Meshset is the same, only modification
1256 } else {
1257 CHKERR addMeshset(mit->second.bcType, mit->second.iD);
1258 EntityHandle meshset = cubit_meshset_it->getMeshset();
1259 CHKERR addEntitiesToMeshset(mit->second.bcType, mit->second.iD,
1260 &meshset, 1);
1261 }
1262 // Add pressure
1263 if (mit->second.pressureBc.data.value1 != 0) {
1264 if (mit->second.pressureBc.data.flag2 == '0')
1265 mit->second.pressureBc.data.flag2 = 0;
1266 if (mit->second.pressureBc.data.flag2 == 'N')
1267 mit->second.pressureBc.data.flag2 = 0;
1268 if (mit->second.pressureBc.data.flag2)
1269 mit->second.pressureBc.data.flag2 = 1;
1270 CHKERR setBcData(mit->second.bcType, mit->second.iD,
1271 mit->second.pressureBc);
1272 }
1273 // Add heat flux
1274 if (mit->second.heatFluxBc.data.value1 != 0) {
1275 if (mit->second.heatFluxBc.data.flag1 == '0')
1276 mit->second.heatFluxBc.data.flag1 = 0;
1277 if (mit->second.heatFluxBc.data.flag1 == 'N')
1278 mit->second.heatFluxBc.data.flag1 = 0;
1279 if (mit->second.heatFluxBc.data.flag1)
1280 mit->second.heatFluxBc.data.flag1 = 1;
1281 CHKERR setBcData(mit->second.bcType, mit->second.iD,
1282 mit->second.heatFluxBc);
1283 }
1284 // Add Interface
1285 if (mit->second.cfgBc.data.type != 0) {
1286 CHKERR setBcData(mit->second.bcType, mit->second.iD, mit->second.cfgBc);
1287 }
1288 } break;
1289 default:
1290 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
1291 "Not yet implemented type\n");
1292 }
1293 }
1294
1295 for (auto set_attr : block_set_attributes) {
1296 // Add attributes
1297 if (set_attr.second.numberOfAttributes > 0) {
1298 MOFEM_LOG("MeshsetMngSelf", Sev::verbose)
1299 << "Set attributes to blockset " << set_attr.second.nAme;
1300 set_attr.second.aTtr.resize(set_attr.second.numberOfAttributes);
1301 CHKERR setAtributes(set_attr.second.bcType, set_attr.second.iD,
1302 set_attr.second.aTtr);
1303 }
1304 }
1305
1307}
#define MOFEM_LOG_C(channel, severity, format,...)
Definition: LogManager.hpp:311
@ LASTSET_BC
Definition: definitions.h:166
@ UNKNOWNSET
Definition: definitions.h:145
static const char *const CubitBCNames[]
Names of types of sets and boundary conditions.
Definition: definitions.h:175
MoFEMErrorCode addMeshset(const CubitBCType cubit_bc_type, const int ms_id, const std::string name="")
add cubit meshset
#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.
MoFEMErrorCode setBcData(const CubitBCType cubit_bc_type, const int ms_id, const GenericCubitBcData &data)
set boundary data structure to meshset
MoFEMErrorCode setAtributes(const CubitBCType cubit_bc_type, const int ms_id, const std::vector< double > &attributes, const std::string name="")
set attributes to cubit meshset
MoFEMErrorCode addEntitiesToMeshset(const CubitBCType cubit_bc_type, const int ms_id, const Range &ents)
add entities to cubit meshset
MoFEMErrorCode setAtributesByDataStructure(const CubitBCType cubit_bc_type, const int ms_id, const GenericAttributeData &data, const std::string name="")
set (material) data structure to cubit meshset

◆ updateAllMeshsetsByEntitiesChildren()

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

Update all blolsets, sidesets and node sets.

Parameters
bit
Returns
MoFEMErrorCode

Definition at line 1368 of file MeshsetsManager.cpp.

1368 {
1370 BitRefManager *bit_mng = cOre.getInterface<BitRefManager>();
1371 for (_IT_CUBITMESHSETS_FOR_LOOP_((*this), iit)) {
1372 EntityHandle meshset = iit->getMeshset();
1373 for (EntityType t = MBVERTEX; t != MBENTITYSET; ++t)
1374 CHKERR bit_mng->updateMeshsetByEntitiesChildren(meshset, bit, meshset, t,
1375 true);
1376 }
1378}
#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 refernce to pointer of interface.

Member Data Documentation

◆ bhTag

Tag MoFEM::MeshsetsManager::bhTag
protected

Definition at line 889 of file MeshsetsManager.hpp.

◆ bhTag_header

Tag MoFEM::MeshsetsManager::bhTag_header
protected

Definition at line 890 of file MeshsetsManager.hpp.

◆ brodcastMeshsets

bool MoFEM::MeshsetsManager::brodcastMeshsets = true
static

if true meshsets are synchrinised between processors

Definition at line 881 of file MeshsetsManager.hpp.

◆ configFileOptionsPtr

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

config file options

Definition at line 895 of file MeshsetsManager.hpp.

◆ cOre

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

Definition at line 109 of file MeshsetsManager.hpp.

◆ cubitMeshsets

CubitMeshSet_multiIndex MoFEM::MeshsetsManager::cubitMeshsets
protected

cubit meshsets

Definition at line 893 of file MeshsetsManager.hpp.

◆ nsTag

Tag MoFEM::MeshsetsManager::nsTag
protected

Definition at line 885 of file MeshsetsManager.hpp.

◆ nsTag_data

Tag MoFEM::MeshsetsManager::nsTag_data
protected

Definition at line 887 of file MeshsetsManager.hpp.

◆ ssTag

Tag MoFEM::MeshsetsManager::ssTag
protected

Definition at line 886 of file MeshsetsManager.hpp.

◆ ssTag_data

Tag MoFEM::MeshsetsManager::ssTag_data
protected

Definition at line 888 of file MeshsetsManager.hpp.


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