v0.13.2
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
add_blockset.cpp, add_cubit_meshsets.cpp, cell_forces.cpp, cubit_bc_test.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, prism_elements_from_surface.cpp, reaction_diffusion.cpp, simple_contact.cpp, split_sideset.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:391
#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:300
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
Definition: LogManager.cpp:346
static boost::shared_ptr< std::ostream > getStrmSync()
Get the strm sync object.
Definition: LogManager.cpp:350
static bool checkIfChannelExist(const std::string channel)
Check if channel exist.
Definition: LogManager.cpp:401
static boost::shared_ptr< std::ostream > getStrmSelf()
Get the strm self object.
Definition: LogManager.cpp:342

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

352 {
353 Interface &m_field = cOre;
354 moab::Interface &moab = m_field.get_moab();
356 auto cit =
357 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
358 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
359 if (cit ==
360 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
361 SETERRQ1(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
362 "Cannot find Cubit meshset with id: %d", ms_id);
363 }
364 EntityHandle meshset = cit->getMeshset();
365 CHKERR moab.add_entities(meshset, ents, nb_ents);
366
368}
#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 330 of file MeshsetsManager.cpp.

331 {
332 Interface &m_field = cOre;
333 moab::Interface &moab = m_field.get_moab();
335 auto cit =
336 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
337 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
338 if (cit ==
339 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
340 SETERRQ1(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
341 "Cannot find Cubit meshset with id: %d", ms_id);
342 }
343 EntityHandle meshset = cit->getMeshset();
344 CHKERR moab.add_entities(meshset, ents);
345
347}

◆ broadcastMeshsets()

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

Boradcats meshsets.

Parameters
verb
Returns
MoFEMErrorCode

Definition at line 90 of file MeshsetsManager.cpp.

90 {
91 Interface &m_field = cOre;
92 moab::Interface &moab = m_field.get_moab();
94
95 ParallelComm *pcomm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
96 if (pcomm == NULL)
97 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
98 "MOAB communicator not set");
99
100 const double coords[] = {0, 0, 0};
101
102 auto set_tags_dummy_node = [&](const EntityHandle dummy_node,
103 const EntityHandle meshset) {
105 std::vector<Tag> tag_handles;
106 CHKERR moab.tag_get_tags_on_entity(meshset, tag_handles);
107 for (auto th : tag_handles) {
108 void *data[1];
109 int tag_size;
110 CHKERR moab.tag_get_by_ptr(th, &meshset, 1, (const void **)data,
111 &tag_size);
112 CHKERR moab.tag_set_by_ptr(th, &dummy_node, 1, data, &tag_size);
113 }
115 };
116
117 for (int from_proc = 0; from_proc < pcomm->size(); ++from_proc) {
118
119 Range r_dummy_nodes;
120
121 if (from_proc == pcomm->rank()) {
122 std::vector<EntityHandle> dummy_nodes(cubitMeshsets.size(), 0);
123 int i = 0;
124 for (auto &m : cubitMeshsets) {
125 CHKERR moab.create_vertex(coords, dummy_nodes[i]);
126 CHKERR set_tags_dummy_node(dummy_nodes[i], m.getMeshset());
127 ++i;
128 }
129 r_dummy_nodes.insert_list(dummy_nodes.begin(), dummy_nodes.end());
130 }
131
132 CHKERR pcomm->broadcast_entities(from_proc, r_dummy_nodes, false, true);
133
134 for (auto dummy_node : r_dummy_nodes) {
136 CHKERR moab.create_meshset(MESHSET_SET, m);
137 CHKERR set_tags_dummy_node(m, dummy_node);
138
139 CubitMeshSets broadcast_block(moab, m);
140 if ((broadcast_block.cubitBcType &
142 .any()) {
143 auto p = cubitMeshsets.insert(broadcast_block);
144 if (!p.second) {
145 CHKERR moab.delete_entities(&m, 1);
146 } else {
147 MOFEM_LOG("MeshsetMngSelf", Sev::noisy)
148 << "broadcast " << broadcast_block;
149 }
150 }
151 }
152
153 CHKERR moab.delete_entities(r_dummy_nodes);
154 }
155
157}
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 638 of file MeshsetsManager.cpp.

640 {
641 auto miit =
642 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
643 boost::make_tuple(ms_id, cubit_bc_type));
644 if (miit !=
645 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
646 Interface &m_field = cOre;
647 return m_field.get_moab().contains_entities(miit->meshset, entities,
648 num_entities, operation_type);
649 } else
650 return false;
651}

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

285 {
286 auto miit = cubitMeshsets.get<CubitMeshsets_name>().lower_bound(name);
287 auto hi_miit = cubitMeshsets.get<CubitMeshsets_name>().upper_bound(name);
288 if (std::distance(miit, hi_miit) == 0) {
289 return false;
290 }
291 if (number_of_meshsets_ptr) {
292 *number_of_meshsets_ptr = std::distance(miit, hi_miit);
293 }
294 return true;
295}

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

467 {
468 Interface &m_field = cOre;
469 moab::Interface &moab = m_field.get_moab();
471 auto miit =
472 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
473 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
474 if (miit ==
475 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
476 if (bh & MF_EXIST) {
477 SETERRQ1(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
478 "meshset not found", ms_id);
479 } else {
481 }
482 }
483 EntityHandle meshset = miit->getMeshset();
484 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().erase(miit);
485 CHKERR moab.delete_entities(&meshset, 1);
486
488}
@ 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 837 of file MeshsetsManager.hpp.

837 {
839 }
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 159 of file MeshsetsManager.cpp.

159 {
161 Interface &m_field = cOre;
162 moab::Interface &moab = m_field.get_moab();
163 int default_val = -1;
164 CHKERR moab.tag_get_handle(DIRICHLET_SET_TAG_NAME, 1, MB_TYPE_INTEGER, nsTag,
165 MB_TAG_SPARSE | MB_TAG_CREAT, &default_val);
166
167 CHKERR moab.tag_get_handle(NEUMANN_SET_TAG_NAME, 1, MB_TYPE_INTEGER, ssTag,
168 MB_TAG_SPARSE | MB_TAG_CREAT, &default_val);
169
170 const int def_bc_data_len = 0;
171 std::string tag_name = std::string(DIRICHLET_SET_TAG_NAME) + "__BC_DATA";
172 CHKERR moab.tag_get_handle(
173 tag_name.c_str(), def_bc_data_len, MB_TYPE_OPAQUE, nsTag_data,
174 MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES | MB_TAG_VARLEN, NULL);
175
176 tag_name = std::string(NEUMANN_SET_TAG_NAME) + "__BC_DATA";
177 CHKERR moab.tag_get_handle(
178 tag_name.c_str(), def_bc_data_len, MB_TYPE_OPAQUE, ssTag_data,
179 MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES | MB_TAG_VARLEN, NULL);
180
181 CHKERR moab.tag_get_handle(MATERIAL_SET_TAG_NAME, 1, MB_TYPE_INTEGER, bhTag,
182 MB_TAG_SPARSE | MB_TAG_CREAT, &default_val);
183
184 std::vector<unsigned int> def_uint_zero(3, 0);
185 CHKERR moab.tag_get_handle(
186 BLOCK_HEADER, 3 * sizeof(unsigned int), MB_TYPE_INTEGER, bhTag_header,
187 MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES, &def_uint_zero[0]);
188
189 Tag block_attribs;
190 int def_Block_Attributes_length = 0;
191 CHKERR moab.tag_get_handle(
192 BLOCK_ATTRIBUTES, def_Block_Attributes_length, MB_TYPE_DOUBLE,
193 block_attribs, MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_VARLEN, NULL);
194
195 Tag entity_name_tag;
196 CHKERR moab.tag_get_handle(NAME_TAG_NAME, NAME_TAG_SIZE, MB_TYPE_OPAQUE,
197 entity_name_tag, MB_TAG_SPARSE | MB_TAG_CREAT);
198
200}

◆ 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 for (auto &m : cubitMeshsets) {
62 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << m;
63 }
64
66}
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 867 of file MeshsetsManager.hpp.

868 {
870 const MoFEM::Interface &m_field = cOre;
871 const moab::Interface &moab = m_field.get_moab();
872 for (_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_((*this), type, it)) {
873 CHKERR it->getBcDataStructure(data);
874 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *it;
875 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << data;
876 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << "name " << it->getName();
877 for (EntityType t = MBVERTEX; t != MBENTITYSET; ++t) {
878 int nb;
879 CHKERR moab.get_number_entities_by_type(it->meshset, t, nb, true);
880 MOFEM_LOG("MeshsetMngWorld", Sev::inform)
881 << "msId " << it->getMeshsetId() << " number of "
882 << moab::CN::EntityTypeName(t) << " " << nb;
883 }
884 }
886}
#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet in a moFEM field.
constexpr double t
plate stiffness
Definition: plate.cpp:59
virtual moab::Interface & get_moab()=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 202 of file MeshsetsManager.cpp.

202 {
203 DisplacementCubitBcData mydata;
205 CHKERR printBcSet(mydata, NODESET | mydata.tYpe.to_ulong());
207}
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 216 of file MeshsetsManager.cpp.

216 {
217 ForceCubitBcData mydata;
219 CHKERR printBcSet(mydata, NODESET | mydata.tYpe.to_ulong());
221}

◆ printHeatFluxSet()

MoFEMErrorCode MoFEM::MeshsetsManager::printHeatFluxSet ( ) const

print meshsets with heat flux boundary conditions data structure

Definition at line 230 of file MeshsetsManager.cpp.

230 {
231 HeatFluxCubitBcData mydata;
233 CHKERR printBcSet(mydata, SIDESET | mydata.tYpe.to_ulong());
235}

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

237 {
239 const Interface &m_field = cOre;
240 const moab::Interface &moab = m_field.get_moab();
242 (*this), BLOCKSET | MAT_ELASTICSET, it)) {
243 Mat_Elastic data;
244 CHKERR it->getAttributeDataStructure(data);
245 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *it;
246 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << data;
247 Range tets;
248 CHKERR moab.get_entities_by_dimension(it->meshset, 3, tets, true);
249 MOFEM_LOG("MeshsetMngWorld", Sev::inform)
250 << "MAT_ELATIC msId " << it->getMeshsetId() << " nb. volumes "
251 << tets.size();
252 }
253
255 m_field, BLOCKSET | MAT_THERMALSET, it)) {
256 Mat_Thermal data;
257 CHKERR it->getAttributeDataStructure(data);
258 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *it;
259 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << data;
260 }
261
263 m_field, BLOCKSET | MAT_MOISTURESET, it)) {
264 Mat_Moisture data;
265 CHKERR it->getAttributeDataStructure(data);
266 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *it;
267 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << data;
268 }
270}
@ 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

◆ printPressureSet()

MoFEMErrorCode MoFEM::MeshsetsManager::printPressureSet ( ) const

print meshsets with pressure boundary conditions data structure

Definition at line 209 of file MeshsetsManager.cpp.

209 {
210 PressureCubitBcData mydata;
212 CHKERR printBcSet(mydata, SIDESET | mydata.tYpe.to_ulong());
214}

◆ printTemperatureSet()

MoFEMErrorCode MoFEM::MeshsetsManager::printTemperatureSet ( ) const

print meshsets with temperature boundary conditions data structure

Definition at line 223 of file MeshsetsManager.cpp.

223 {
224 TemperatureCubitBcData mydata;
226 CHKERR printBcSet(mydata, NODESET | mydata.tYpe.to_ulong());
228}

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

68 {
69 Interface &m_field = cOre;
70 moab::Interface &moab = m_field.get_moab();
72
73 Range meshsets;
74 CHKERR moab.get_entities_by_type(0, MBENTITYSET, meshsets, false);
75 for (auto m : meshsets) {
76 // check if meshset is cubit meshset
77 CubitMeshSets block(moab, m);
78 if ((block.cubitBcType & CubitBCType(NODESET | SIDESET | BLOCKSET)).any()) {
79 auto p = cubitMeshsets.insert(block);
80 if (!p.second)
81 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
82 "meshset not inserted");
83 MOFEM_LOG("MeshsetMngSelf", Sev::noisy) << "read " << block;
84 }
85 }
86
88}

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

1329 {
1330
1332 MoFEM::Interface &m_field = cOre;
1333 moab::Interface &moab = m_field.get_moab();
1334 Range entities;
1335 CHKERR getEntitiesByDimension(ms_id, cubit_bc_type, dim, entities, recursive);
1336 EntityHandle meshset;
1337 CHKERR moab.create_meshset(MESHSET_SET, meshset);
1338 CHKERR moab.add_entities(meshset, entities);
1339 CHKERR moab.write_file(file_name.c_str(), file_type.c_str(), options.c_str(),
1340 &meshset, 1);
1341 CHKERR moab.delete_entities(&meshset, 1);
1343}
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 1311 of file MeshsetsManager.cpp.

1314 {
1315
1317 MoFEM::Interface &m_field = cOre;
1318 const CubitMeshSets *cubit_meshset_ptr;
1319 CHKERR getCubitMeshsetPtr(ms_id, cubit_bc_type, &cubit_meshset_ptr);
1320 EntityHandle meshset = cubit_meshset_ptr->getMeshset();
1321 CHKERR m_field.get_moab().write_file(file_name.c_str(), file_type.c_str(),
1322 options.c_str(), &meshset, 1);
1324}
MoFEMErrorCode getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr) const
get cubit meshset

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

373 {
374 Interface &m_field = cOre;
375 moab::Interface &moab = m_field.get_moab();
377 auto cit =
378 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
379 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
380 if (cit ==
381 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
382 SETERRQ1(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
383 "Cannot find Cubit meshset with id: %d", ms_id);
384 }
385 if (name.size() > 0) {
386 bool success = cubitMeshsets.modify(cubitMeshsets.project<0>(cit),
387 CubitMeshSets_change_name(moab, name));
388 if (!success) {
389 SETERRQ(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
390 "name to cubit meshset can not be set");
391 }
392 }
393 bool success =
394 cubitMeshsets.modify(cubitMeshsets.project<0>(cit),
395 CubitMeshSets_change_attributes(moab, attributes));
396 if (!success)
397 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
398 "modification unsuccessful");
399
400 std::ostringstream ss;
401 ss << "Block " << cit->getName();
402 ss << " Add attr: ";
403 for (unsigned int ii = 0; ii != attributes.size(); ii++) {
404 ss << attributes[ii] << " ";
405 }
406 MOFEM_LOG("MeshsetMngSelf", Sev::noisy) << ss.str();
407
409}
@ 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 411 of file MeshsetsManager.cpp.

413 {
414 Interface &m_field = cOre;
415 moab::Interface &moab = m_field.get_moab();
417 auto cit =
418 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
419 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
420 if (cit ==
421 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
422 SETERRQ1(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
423 "Cannot find Cubit meshset with id: %d", ms_id);
424 }
425 if (name.size() > 0) {
426 bool success = cubitMeshsets.modify(cubitMeshsets.project<0>(cit),
427 CubitMeshSets_change_name(moab, name));
428 if (!success) {
429 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
430 "name to cubit meshset can not be set");
431 }
432 }
433 bool success = cubitMeshsets.modify(
434 cubitMeshsets.project<0>(cit),
435 CubitMeshSets_change_attributes_data_structure(moab, data));
436 if (!success)
437 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
438 "modification unsuccessful");
440}

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

444 {
445 Interface &m_field = cOre;
446 moab::Interface &moab = m_field.get_moab();
448 auto cit =
449 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
450 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
451 if (cit ==
452 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
453 SETERRQ1(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
454 "Cubit meshset with id is already there", ms_id);
455 }
456 bool success =
457 cubitMeshsets.modify(cubitMeshsets.project<0>(cit),
458 CubitMeshSets_change_bc_data_structure(moab, data));
459 if (!success)
460 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
461 "modification unsuccessful");
463}

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

1287 {
1288 Interface &m_field = cOre;
1289 PetscBool flg_file;
1290 char meshset_file_name[255] = "config_file.cfg";
1292 CHKERR PetscOptionsBegin(m_field.get_comm(), "", "Set meshsets form file",
1293 "none");
1294 CHKERR PetscOptionsString("-meshsets_config", "meshsets config file name",
1295 "", "add_cubit_meshsets.in", meshset_file_name, 255,
1296 &flg_file);
1297 if (flg_file == PETSC_TRUE) {
1298 ifstream f(meshset_file_name);
1299 if (!f.good()) {
1300 SETERRQ1(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
1301 "File configuring meshsets ( %s ) can not be open\n",
1302 meshset_file_name);
1303 }
1304 CHKERR setMeshsetFromFile(string(meshset_file_name));
1305 }
1306 ierr = PetscOptionsEnd();
1307 CHKERRG(ierr);
1309}
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:483
auto f
Definition: HenckyOps.hpp:5
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 703 of file MeshsetsManager.cpp.

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

1346 {
1348 BitRefManager *bit_mng = cOre.getInterface<BitRefManager>();
1349 for (_IT_CUBITMESHSETS_FOR_LOOP_((*this), iit)) {
1350 EntityHandle meshset = iit->getMeshset();
1351 for (EntityType t = MBVERTEX; t != MBENTITYSET; ++t)
1352 CHKERR bit_mng->updateMeshsetByEntitiesChildren(meshset, bit, meshset, t,
1353 true);
1354 }
1356}
#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 857 of file MeshsetsManager.hpp.

◆ bhTag_header

Tag MoFEM::MeshsetsManager::bhTag_header
protected

Definition at line 858 of file MeshsetsManager.hpp.

◆ brodcastMeshsets

bool MoFEM::MeshsetsManager::brodcastMeshsets = true
static

if true meshsets are synchrinised between processors

Definition at line 849 of file MeshsetsManager.hpp.

◆ configFileOptionsPtr

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

config file options

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

◆ nsTag

Tag MoFEM::MeshsetsManager::nsTag
protected

Definition at line 853 of file MeshsetsManager.hpp.

◆ nsTag_data

Tag MoFEM::MeshsetsManager::nsTag_data
protected

Definition at line 855 of file MeshsetsManager.hpp.

◆ ssTag

Tag MoFEM::MeshsetsManager::ssTag
protected

Definition at line 854 of file MeshsetsManager.hpp.

◆ ssTag_data

Tag MoFEM::MeshsetsManager::ssTag_data
protected

Definition at line 856 of file MeshsetsManager.hpp.


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