v0.15.0
Loading...
Searching...
No Matches
Files | Classes | Macros | Functions
MeshsetsManager

Interface for meshsets with entities with data and boundary conditions. More...

Collaboration diagram for MeshsetsManager:

Files

file  MeshsetsManager.hpp
 Interface for managing mesh sets containing materials and boundary conditions.
 

Classes

struct  MoFEM::MeshsetsManager
 Interface for managing meshsets containing materials and boundary conditions. More...
 

Macros

#define _IT_CUBITMESHSETS_FOR_LOOP_(MESHSET_MANAGER, IT)
 Iterator that loops over all the Cubit MeshSets in a moFEM field.
 
#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
 Iterator that loops over a specific Cubit MeshSet in a moFEM field.
 
#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.
 
#define _IT_CUBITMESHSETS_BY_NAME_FOR_LOOP_(MESHSET_MANAGER, NAME, IT)
 Iterator that loops over Cubit BlockSet having a particular name.
 

Functions

MoFEMErrorCode MoFEM::MeshsetsManager::getTags (int verb=-1)
 Get tag handles used on meshsets.
 
static MoFEMErrorCode MoFEM::MeshsetsManager::getTags (moab::Interface &moab, Tag &nsTag, Tag &ssTag, Tag &nsTag_data, Tag &ssTag_data, Tag &bhTag, Tag &bhTag_header, int verb=-1)
 Static version of getTags for external MOAB interface.
 
MoFEMErrorCode MoFEM::MeshsetsManager::clearMap ()
 Clear the multi-index container.
 
MoFEMErrorCode MoFEM::MeshsetsManager::initialiseDatabaseFromMesh (int verb=DEFAULT_VERBOSITY)
 Initialize container from mesh data.
 
MoFEMErrorCode MoFEM::MeshsetsManager::readMeshsets (int verb=DEFAULT_VERBOSITY)
 Read meshsets from mesh database.
 
MoFEMErrorCode MoFEM::MeshsetsManager::broadcastMeshsets (int verb=DEFAULT_VERBOSITY)
 Broadcast meshsets across MPI processes.
 
MoFEMErrorCode MoFEM::MeshsetsManager::printDisplacementSet () const
 Print meshsets with displacement boundary conditions.
 
MoFEMErrorCode MoFEM::MeshsetsManager::printPressureSet () const
 Print meshsets with pressure boundary conditions.
 
MoFEMErrorCode MoFEM::MeshsetsManager::printForceSet () const
 Print meshsets with force boundary conditions.
 
MoFEMErrorCode MoFEM::MeshsetsManager::printTemperatureSet () const
 Print meshsets with temperature boundary conditions.
 
MoFEMErrorCode MoFEM::MeshsetsManager::printHeatFluxSet () const
 Print meshsets with heat flux boundary conditions.
 
MoFEMErrorCode MoFEM::MeshsetsManager::printMaterialsSet () const
 Print meshsets with material properties.
 
CubitMeshSet_multiIndex::iterator MoFEM::MeshsetsManager::getBegin () const
 get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
CubitMeshSet_multiIndex::iterator MoFEM::MeshsetsManager::getEnd () const
 get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
CubitMeshsetByType::iterator MoFEM::MeshsetsManager::getBegin (const unsigned int cubit_bc_type) const
 get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
CubitMeshsetByType::iterator MoFEM::MeshsetsManager::getEnd (const unsigned int cubit_bc_type) const
 get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
CubitMeshsetByMask::iterator MoFEM::MeshsetsManager::getBySetTypeBegin (const unsigned int cubit_bc_type) const
 get end iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
CubitMeshsetByMask::iterator MoFEM::MeshsetsManager::getBySetTypeEnd (const unsigned int cubit_bc_type) const
 get end iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
CubitMeshsetByName::iterator MoFEM::MeshsetsManager::getBegin (const std::string &name) const
 get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
CubitMeshsetByName::iterator MoFEM::MeshsetsManager::getEnd (const std::string &name) const
 get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)
 
bool MoFEM::MeshsetsManager::checkMeshset (const int ms_id, const CubitBCType cubit_bc_type) const
 Check for CUBIT meshset by ID and type.
 
bool MoFEM::MeshsetsManager::checkMeshset (const string name, int *const number_of_meshsets_ptr=NULL) const
 Check if meshset with given name exists.
 
MoFEMErrorCode MoFEM::MeshsetsManager::addMeshset (const CubitBCType cubit_bc_type, const int ms_id, const std::string name="")
 Add CUBIT meshset to manager.
 
MoFEMErrorCode MoFEM::MeshsetsManager::addEntitiesToMeshset (const CubitBCType cubit_bc_type, const int ms_id, const Range &ents)
 Add entities to CUBIT meshset.
 
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 (array version)
 
MoFEMErrorCode MoFEM::MeshsetsManager::setAttributes (const CubitBCType cubit_bc_type, const int ms_id, const std::vector< double > &attributes, const std::string name="")
 Set attributes for CUBIT meshset.
 
MoFEMErrorCode MoFEM::MeshsetsManager::setAttributesByDataStructure (const CubitBCType cubit_bc_type, const int ms_id, const GenericAttributeData &data, const std::string name="")
 Set attributes using data structure.
 
MoFEMErrorCode MoFEM::MeshsetsManager::setBcData (const CubitBCType cubit_bc_type, const int ms_id, const GenericCubitBcData &data)
 Set boundary condition data for meshset.
 
MoFEMErrorCode MoFEM::MeshsetsManager::getCubitMeshsetPtr (const int ms_id, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr) const
 get cubit meshset
 
const CubitMeshSetsMoFEM::MeshsetsManager::getCubitMeshsetPtr (const int ms_id, const CubitBCType cubit_bc_type) const
 get cubit meshset
 
MoFEMErrorCode MoFEM::MeshsetsManager::getCubitMeshsetPtr (const CubitBCType cubit_bc_type, std::vector< const CubitMeshSets * > &vec_ptr) const
 Get vector of pointer by bc type.
 
std::vector< const CubitMeshSets * > MoFEM::MeshsetsManager::getCubitMeshsetPtr (const CubitBCType cubit_bc_type) const
 Get vector of pointer by bc type.
 
MoFEMErrorCode MoFEM::MeshsetsManager::getCubitMeshsetPtr (const string name, const CubitMeshSets **cubit_meshset_ptr) const
 get cubit meshset
 
MoFEMErrorCode MoFEM::MeshsetsManager::getCubitMeshsetPtr (const std::regex reg_exp_name, std::vector< const CubitMeshSets * > &vec_ptr) const
 Get vector of pointer to blocksets with name satisfying regular expression.
 
std::vector< const CubitMeshSets * > MoFEM::MeshsetsManager::getCubitMeshsetPtr (const std::regex reg_exp_name) const
 Get vector of pointer to blocksets with name satisfying regular expression.
 
MoFEMErrorCode MoFEM::MeshsetsManager::getEntitiesByDimension (const int ms_id, const unsigned int cubit_bc_type, const int dimension, Range &entities, const bool recursive=true) const
 get entities from CUBIT/meshset of a particular entity dimension
 
MoFEMErrorCode MoFEM::MeshsetsManager::getEntitiesByDimension (const int ms_id, const unsigned int cubit_bc_type, Range &entities, const bool recursive=true) const
 get entities related to CUBIT/meshset,
 
MoFEMErrorCode MoFEM::MeshsetsManager::getMeshset (const int ms_id, const unsigned int cubit_bc_type, EntityHandle &meshset) const
 get meshset from CUBIT Id and CUBIT type
 
MoFEMErrorCode MoFEM::MeshsetsManager::getMeshsetsByType (const unsigned int cubit_bc_type, Range &meshsets) const
 get all CUBIT meshsets by CUBIT type
 
MoFEMErrorCode MoFEM::MeshsetsManager::setMeshsetFromFile ()
 Load meshset configuration from command line specified file.
 

Detailed Description

Interface for meshsets with entities with data and boundary conditions.

Macro Definition Documentation

◆ _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_

#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_ (   MESHSET_MANAGER,
  CUBITBCTYPE,
  IT 
)

#include <src/interfaces/MeshsetsManager.hpp>

Value:
CubitMeshsetByType::iterator IT = \
MESHSET_MANAGER.get_meshsets_manager_ptr()->getBegin(CUBITBCTYPE); \
IT != MESHSET_MANAGER.get_meshsets_manager_ptr()->getEnd(CUBITBCTYPE); \
IT++
constexpr IntegrationType IT

Iterator that loops over a specific Cubit MeshSet in a moFEM field.

Parameters
mFieldmoFEM Field
seeCubitBC (NODESET, SIDESET or BLOCKSET and more)
iterator
Examples
mofem/atom_tests/add_cubit_meshsets.cpp, mofem/atom_tests/field_blas.cpp, mofem/atom_tests/field_blas_axpy.cpp, mofem/tutorials/cor-6/simple_elasticity.cpp, mofem/tutorials/cor-7/src/ElasticityMixedFormulation.hpp, mofem/users_modules/basic_finite_elements/elasticity/elasticity.cpp, mofem/users_modules/basic_finite_elements/nonlinear_elasticity/nonlinear_dynamics.cpp, mofem/users_modules/basic_finite_elements/src/impl/HookeElement.cpp, and mofem/users_modules/bone_remodelling/bone_adaptation.cpp.

Definition at line 72 of file MeshsetsManager.hpp.

207 : public UnknownInterface {
208
209 /**
210 * \brief Query interface for MeshsetsManager
211 *
212 * @param type_index type index for the interface to query
213 * @param iface pointer to store the interface
214 * @return MoFEMErrorCode Error code indicating success or failure
215 */
216 MoFEMErrorCode query_interface(boost::typeindex::type_index type_index,
217 UnknownInterface **iface) const;
218
219 MoFEM::Core &cOre; ///< Reference to MoFEM Core interface
220
221 /**
222 * \brief Constructor for MeshsetsManager
223 *
224 * @param core reference to MoFEM Core interface for accessing mesh and field data
225 */
226 MeshsetsManager(const MoFEM::Core &core);
227 virtual ~MeshsetsManager() = default;
228
229 /**
230 * \brief Get tag handles used on meshsets
231 * \ingroup mofem_meshset_mng
232 *
233 * Retrieves MOAB tag handles for meshset identification and data storage.
234 * These tags follow CUBIT/MOAB conventions for nodesets, sidesets, and blocksets.
235 * The function initializes internal tag handles for subsequent meshset operations.
236 *
237 * @param verb verbosity level for output (-1 = default, higher values = more verbose)
238 * @return MoFEMErrorCode Error code indicating success or failure
239 */
240 MoFEMErrorCode getTags(int verb = -1);
241
242 /**
243 * \brief Static version of getTags for external MOAB interface
244 * \ingroup mofem_meshset_mng
245 *
246 * @param moab reference to MOAB interface
247 * @param nsTag reference to store nodeset tag handle
248 * @param ssTag reference to store sideset tag handle
249 * @param nsTag_data reference to store nodeset data tag handle
250 * @param ssTag_data reference to store sideset data tag handle
251 * @param bhTag reference to store blockset tag handle
252 * @param bhTag_header reference to store blockset header tag handle
253 * @param verb verbosity level for output
254 * @return MoFEMErrorCode Error code indicating success or failure
255 */
256 static MoFEMErrorCode getTags(moab::Interface &moab, Tag &nsTag, Tag &ssTag,
257 Tag &nsTag_data, Tag &ssTag_data, Tag &bhTag,
258 Tag &bhTag_header, int verb = -1);
259
260 /**
261 * \brief get tag handle used to store "id" of NODESET
262 */
263 inline Tag get_nsTag() const { return nsTag; }
264
265 /**
266 * \brief get tag handle used to store "id" of SIDESET
267 */
268 inline Tag get_ssTag() const { return ssTag; }
269
270 /**
271 * \brief get tag handle used to store boundary data on NODESET
272 */
273 inline Tag get_nsTag_data() const { return nsTag_data; }
274
275 /**
276 * \brief get tag handle used to store boundary data on SIDESET
277 */
278 inline Tag get_ssTag_data() const { return ssTag_data; }
279
280 /**
281 * \brief get tag handle used to store "id" of BLOCKSET
282 */
283 inline Tag get_bhTag() const { return bhTag; }
284
285 /**
286 * \brief get tag handle used to store of block set header (Used by Cubit)
287 */
288 inline Tag get_bhTag_header() const { return bhTag_header; }
289
290 /**
291 * \brief return pointer to meshset manager
292 */
293 MeshsetsManager *get_meshsets_manager_ptr() { return this; }
294
295 /**
296 * \brief return pointer to meshset manager
297 */
298 const MeshsetsManager *get_meshsets_manager_ptr() const { return this; }
299
300 /**
301 * \brief Clear the multi-index container
302 * \ingroup mofem_meshset_mng
303 *
304 * Removes all stored meshset data from the internal container.
305 * Useful for reinitialization or memory cleanup.
306 *
307 * @return MoFEMErrorCode Error code indicating success or failure
308 */
309 MoFEMErrorCode clearMap();
310
311 /**
312 * \brief Initialize container from mesh data
313 * \ingroup mofem_meshset_mng
314 *
315 * Reads meshset information from the mesh database and populates the
316 * internal multi-index container. This includes discovering nodesets,
317 * sidesets, and blocksets with their associated tags and data.
318 *
319 * @param verb verbosity level for output
320 * @return MoFEMErrorCode Error code indicating success or failure
321 */
322 MoFEMErrorCode initialiseDatabaseFromMesh(int verb = DEFAULT_VERBOSITY);
323
324 /**
325 * @brief Read meshsets from mesh database
326 * \ingroup mofem_meshset_mng
327 *
328 * Scans the mesh for existing meshsets and populates the manager's
329 * internal data structures. This is typically called after mesh loading
330 * to discover all available nodesets, sidesets, and blocksets.
331 *
332 * @param verb verbosity level for output
333 * @return MoFEMErrorCode Error code indicating success or failure
334 */
335 MoFEMErrorCode readMeshsets(int verb = DEFAULT_VERBOSITY);
336
337 /**
338 * @brief Broadcast meshsets across MPI processes
339 * \ingroup mofem_meshset_mng
340 *
341 * Synchronizes meshset information across all MPI processes to ensure
342 * consistent meshset data in parallel computations. Typically called
343 * after meshset modifications on specific processes.
344 *
345 * @param verb verbosity level for output
346 * @return MoFEMErrorCode Error code indicating success or failure
347 */
348 MoFEMErrorCode broadcastMeshsets(int verb = DEFAULT_VERBOSITY);
349
350 template <class CUBIT_BC_DATA_TYPE>
351 MoFEMErrorCode printBcSet(CUBIT_BC_DATA_TYPE &data,
352 unsigned long int type) const;
353
354 /**
355 * \brief Print meshsets with displacement boundary conditions
356 * \ingroup mofem_meshset_mng
357 *
358 * Outputs information about all meshsets containing displacement boundary
359 * condition data, including constraint flags and prescribed values.
360 *
361 * @return MoFEMErrorCode Error code indicating success or failure
362 */
363 MoFEMErrorCode printDisplacementSet() const;
364
365 /**
366 * \brief Print meshsets with pressure boundary conditions
367 * \ingroup mofem_meshset_mng
368 *
369 * Outputs information about all meshsets containing pressure boundary
370 * condition data, including pressure magnitudes and application flags.
371 *
372 * @return MoFEMErrorCode Error code indicating success or failure
373 */
374 MoFEMErrorCode printPressureSet() const;
375
376 /**
377 * \brief Print meshsets with force boundary conditions
378 * \ingroup mofem_meshset_mng
379 *
380 * Outputs information about all meshsets containing force boundary
381 * condition data, including force and moment components.
382 *
383 * @return MoFEMErrorCode Error code indicating success or failure
384 */
385 MoFEMErrorCode printForceSet() const;
386
387 /**
388 * \brief Print meshsets with temperature boundary conditions
389 * \ingroup mofem_meshset_mng
390 *
391 * Outputs information about all meshsets containing temperature boundary
392 * condition data, including prescribed temperature values.
393 *
394 * @return MoFEMErrorCode Error code indicating success or failure
395 */
396 MoFEMErrorCode printTemperatureSet() const;
397
398 /**
399 * \brief Print meshsets with heat flux boundary conditions
400 * \ingroup mofem_meshset_mng
401 *
402 * Outputs information about all meshsets containing heat flux boundary
403 * condition data, including flux magnitudes and directions.
404 *
405 * @return MoFEMErrorCode Error code indicating success or failure
406 */
407 MoFEMErrorCode printHeatFluxSet() const;
408
409 /**
410 * \brief Print meshsets with material properties
411 * \ingroup mofem_meshset_mng
412 *
413 * Outputs information about all meshsets containing material data,
414 * including material parameters and constitutive model information.
415 *
416 * @return MoFEMErrorCode Error code indicating success or failure
417 */
418 MoFEMErrorCode printMaterialsSet() const;
419
420 inline CubitMeshSet_multiIndex &getMeshsetsMultindex() {
421 return cubitMeshsets;
422 }
423
424 /**
425 * \ingroup mofem_meshset_mng
426 * \brief get begin iterator of cubit meshset of given type (instead you can
427 * use _IT_CUBITMESHSETS_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
428 *
429 * for(_IT_CUBITMESHSETS_FOR_LOOP_(mField,it) {
430 * ...
431 * }
432 *
433 */
434 inline CubitMeshSet_multiIndex::iterator getBegin() const {
435 return cubitMeshsets.begin();
436 }
437
438 /**
439 * \ingroup mofem_meshset_mng
440 * \brief get begin iterator of cubit meshset of given type (instead you can
441 * use _IT_CUBITMESHSETS_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
442 *
443 * for(_IT_CUBITMESHSETS_FOR_LOOP_(mField,it) {
444 * ...
445 * }
446 *
447 */
448 CubitMeshSet_multiIndex::iterator getEnd() const {
449 return cubitMeshsets.end();
450 }
451
452 /**
453 * \brief get begin iterator of cubit meshset of given type (instead you can
454 use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
455 * \ingroup mofem_meshset_mng
456
457 *
458 *
459 for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
460 {
461 * ...
462 * }
463 *
464 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
465 */
466 inline CubitMeshsetByType::iterator
467 getBegin(const unsigned int cubit_bc_type) const {
468 return cubitMeshsets.get<CubitMeshsetType_mi_tag>().lower_bound(
469 cubit_bc_type);
470 }
471
472 /**
473 * \brief get begin iterator of cubit meshset of given type (instead you can
474 use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
475 * \ingroup mofem_meshset_mng
476
477 *
478 *
479 for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
480 {
481 * ...
482 * }
483 *
484 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
485 */
486 inline CubitMeshsetByType::iterator
487 getEnd(const unsigned int cubit_bc_type) const {
488 return cubitMeshsets.get<CubitMeshsetType_mi_tag>().upper_bound(
489 cubit_bc_type);
490 }
491
492 /**
493 * \brief get end iterator of cubit meshset of given type (instead you can
494 use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
495 * \ingroup mofem_meshset_mng
496
497 *
498 * for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET,it) {
499 * ...
500 * }
501 *
502 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
503 */
504 inline CubitMeshsetByMask::iterator
505 getBySetTypeBegin(const unsigned int cubit_bc_type) const {
506 return cubitMeshsets.get<CubitMeshsetMaskedType_mi_tag>().lower_bound(
507 cubit_bc_type);
508 }
509
510 /**
511 * \brief get end iterator of cubit meshset of given type (instead you can
512 use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
513 * \ingroup mofem_meshset_mng
514
515 *
516 * for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET,it) {
517 * ...
518 * }
519 *
520 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
521 */
522 inline CubitMeshsetByMask::iterator
523 getBySetTypeEnd(const unsigned int cubit_bc_type) const {
524 return cubitMeshsets.get<CubitMeshsetMaskedType_mi_tag>().upper_bound(
525 cubit_bc_type);
526 }
527
528 /**
529 * \brief get begin iterator of cubit meshset of given type (instead you can
530 use _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
531 * \ingroup mofem_meshset_mng
532
533 *
534 *
535 for(_IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
536 {
537 * ...
538 * }
539 *
540 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
541 */
542 inline CubitMeshsetByName::iterator getBegin(const std::string &name) const {
543 return cubitMeshsets.get<CubitMeshsets_name>().lower_bound(name);
544 }
545
546 /**
547 * \brief get begin iterator of cubit meshset of given type (instead you can
548 use _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
549 * \ingroup mofem_meshset_mng
550
551 *
552 *
553 for(_IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
554 {
555 * ...
556 * }
557 *
558 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
559 */
560 inline CubitMeshsetByName::iterator getEnd(const std::string &name) const {
561 return cubitMeshsets.get<CubitMeshsets_name>().upper_bound(name);
562 }
563
564 /**
565 * \brief Check for CUBIT meshset by ID and type
566 * \ingroup mofem_meshset_mng
567 *
568 * Verifies if a meshset with the specified CUBIT ID and type exists
569 * in the manager's database. Useful for validation before accessing
570 * meshset properties or entities.
571 *
572 * \todo All cubit interface functions should be outsourced to dedicated
573 * interface
574 *
575 * @param ms_id CUBIT ID of the meshset (BLOCKSET/SIDESET/NODESET)
576 * @param cubit_bc_type type of meshset (NODESET, SIDESET, BLOCKSET, etc.)
577 * @return bool true if meshset exists, false otherwise
578 */
579 bool checkMeshset(const int ms_id, const CubitBCType cubit_bc_type) const;
580
581 /**
582 * \brief Check if meshset with given name exists
583 * \ingroup mofem_meshset_mng
584 *
585 * Searches for meshsets by name and optionally returns the count of
586 * matching meshsets. Multiple meshsets can have the same name.
587 *
588 * @param name name of the meshset to search for
589 * @param number_of_meshsets_ptr optional pointer to store count of matching meshsets
590 * @return bool true if at least one meshset with the name exists, false otherwise
591 */
592 bool checkMeshset(const string name,
593 int *const number_of_meshsets_ptr = NULL) const;
594
595 /**
596 * \brief Add CUBIT meshset to manager
597 * \ingroup mofem_meshset_mng
598 *
599 * Creates a new meshset entry in the manager's database with the specified
600 * CUBIT type and ID. The meshset can be given an optional name for easier
601 * identification and access.
602 *
603 * @param cubit_bc_type type of meshset (NODESET, SIDESET, BLOCKSET, etc.)
604 * @param ms_id CUBIT ID for the meshset
605 * @param name optional name for the meshset (empty string if not specified)
606 * @return MoFEMErrorCode Error code indicating success or failure
607 */
608 MoFEMErrorCode addMeshset(const CubitBCType cubit_bc_type, const int ms_id,
609 const std::string name = "");
610
611 /**
612 * \brief Add entities to CUBIT meshset
613 * \ingroup mofem_meshset_mng
614 *
615 * Adds a range of mesh entities to an existing meshset. The entities
616 * become part of the meshset for subsequent operations like applying
617 * boundary conditions or material properties.
618 *
619 * @param cubit_bc_type type of meshset (NODESET, SIDESET, BLOCKSET, etc.)
620 * @param ms_id CUBIT ID of the target meshset
621 * @param ents range of entities to add to the meshset
622 * @return MoFEMErrorCode Error code indicating success or failure
623 */
624 MoFEMErrorCode addEntitiesToMeshset(const CubitBCType cubit_bc_type,
625 const int ms_id, const Range &ents);
626
627 /**
628 * \brief Add entities to CUBIT meshset (array version)
629 * \ingroup mofem_meshset_mng
630 *
631 * Adds an array of mesh entities to an existing meshset. This version
632 * accepts entities as a C-style array with explicit count.
633 *
634 * @param cubit_bc_type type of meshset (NODESET, SIDESET, BLOCKSET, etc.)
635 * @param ms_id CUBIT ID of the target meshset
636 * @param ents pointer to array of entity handles
637 * @param nb_ents number of entities in the array
638 * @return MoFEMErrorCode Error code indicating success or failure
639 */
640 MoFEMErrorCode addEntitiesToMeshset(const CubitBCType cubit_bc_type,
641 const int ms_id, const EntityHandle *ents,
642 const int nb_ents);
643
644 /**
645 * \brief Set attributes for CUBIT meshset
646 * \ingroup mofem_meshset_mng
647 *
648 * Assigns attribute values to a meshset. Attributes are typically used
649 * for material properties or other numerical parameters associated with
650 * the meshset entities.
651 *
652 * @param cubit_bc_type type of meshset (BLOCKSET, NODESET, SIDESET, etc.)
653 * @param ms_id CUBIT ID of the target meshset
654 * @param attributes vector of attribute values to assign
655 * @param name optional name to assign to the meshset
656 * @return MoFEMErrorCode Error code indicating success or failure
657 */
658 MoFEMErrorCode setAttributes(const CubitBCType cubit_bc_type, const int ms_id,
659 const std::vector<double> &attributes,
660 const std::string name = "");
661
662 DEPRECATED inline auto setAtributes(const CubitBCType cubit_bc_type,
663 const int ms_id,
664 const std::vector<double> &attributes,
665 const std::string name = "") {
666 return setAttributes(cubit_bc_type, ms_id,
667 std::vector<double>(attributes), name);
668 }
669
670 /**
671 * \brief Set attributes using data structure
672 * \ingroup mofem_meshset_mng
673 *
674 * Assigns material or other attributes to a meshset using a structured
675 * data object. This provides a more organized way to handle complex
676 * attribute data with proper typing and validation.
677 *
678 * @param cubit_bc_type type of meshset (BLOCKSET, NODESET, SIDESET, etc.)
679 * @param ms_id CUBIT ID of the target meshset
680 * @param data structured data containing attribute information
681 * @param name optional name to assign to the meshset
682 * @return MoFEMErrorCode Error code indicating success or failure
683 */
684 MoFEMErrorCode setAttributesByDataStructure(const CubitBCType cubit_bc_type,
685 const int ms_id,
686 const GenericAttributeData &data,
687 const std::string name = "");
688
689 DEPRECATED inline auto setAtributesByDataStructure(
690 const CubitBCType cubit_bc_type, const int ms_id,
691 const GenericAttributeData &data, const std::string name = "") {
692 return setAttributesByDataStructure(cubit_bc_type, ms_id, data, name);
693 }
694
695
696 /**
697 * \brief Set boundary condition data for meshset
698 * \ingroup mofem_meshset_mng
699 *
700 * Assigns boundary condition data to a meshset. This includes constraint
701 * information, prescribed values, and application flags for various
702 * boundary condition types (displacement, force, pressure, etc.).
703 *
704 * @param cubit_bc_type type of meshset (BLOCKSET, NODESET, SIDESET, etc.)
705 * @param ms_id CUBIT ID of the target meshset
706 * @param data boundary condition data structure
707 * @return MoFEMErrorCode Error code indicating success or failure
708 */
709 MoFEMErrorCode setBcData(const CubitBCType cubit_bc_type, const int ms_id,
710 const GenericCubitBcData &data);
711
712 /**
713 * \brief delete cubit meshset
714 * \ingroup mofem_bc
715
716 *
717 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
718 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
719 *
720 */
721 MoFEMErrorCode deleteMeshset(const CubitBCType cubit_bc_type, const int ms_id,
722 const MoFEMTypes bh = MF_EXIST);
723
724 /**
725 * \brief get cubit meshset
726 * \ingroup mofem_meshset_mng
727 *
728 *
729 */
731 getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type,
732 const CubitMeshSets **cubit_meshset_ptr) const;
733
734 /**
735 * \brief get cubit meshset
736 * \ingroup mofem_meshset_mng
737 *
738 *
739 */
740 const CubitMeshSets *
741 getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type) const;
742
743 /**
744 * @brief Get vector of pointer by bc type
745 *
746 * \ingroup mofem_meshset_mng
747 *
748 * @param std::vector<const CubitMeshSets *>
749 * @return MoFEMErrorCode
750 */
752 getCubitMeshsetPtr(const CubitBCType cubit_bc_type,
753 std::vector<const CubitMeshSets *> &vec_ptr) const;
754
755/**
756 * @brief Get vector of pointer by bc type
757 *
758 * \ingroup mofem_meshset_mng
759 *
760 * @return MoFEMErrorCode
761 */
762 std::vector<const CubitMeshSets *>
763 getCubitMeshsetPtr(const CubitBCType cubit_bc_type) const;
764
765 /**
766 * \brief get cubit meshset
767 *
768 * \ingroup mofem_meshset_mng
769 */
771 getCubitMeshsetPtr(const string name,
772 const CubitMeshSets **cubit_meshset_ptr) const;
773
774 /**
775 * @brief Get vector of pointer to blocksets with name satisfying regular
776 * expression.
777 *
778 * \ingroup mofem_meshset_mng
779 *
780 * @param reg_exp_name
781 * @param std::vector<const CubitMeshSets *>
782 * @return MoFEMErrorCode
783 */
785 getCubitMeshsetPtr(const std::regex reg_exp_name,
786 std::vector<const CubitMeshSets *> &vec_ptr) const;
787
788 /**
789 * @brief Get vector of pointer to blocksets with name satisfying regular
790 * expression.
791 *
792 * \ingroup mofem_meshset_mng
793 *
794 * \code
795 for (auto m :
796 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
797
798 (boost::format("%s(.*)") % block_name).str()
799
800 ))
801
802 ) {
803 MOFEM_LOG("WORLD", Sev::inform) << m->getName();
804
805 Range ents;
806 m_field.get_moab().get_entities_by_dimension(
807 m->getMeshset(), 0, ents, false);
808
809 auto print_ents = [](boost::shared_ptr<FieldEntity> ent_ptr) {
810 MoFEMFunctionBegin;
811 if(!(ent_ptr->getPStatus() & PSTATUS_NOT_OWNED)) {
812 MOFEM_LOG("SYNC", Sev::inform) << ent_ptr->getName() << ": " <<
813 ent_ptr->getEntFieldData();
814 }
815 MoFEMFunctionReturn(0);
816 };
817
818 CHKERR m_field.getInterface<FieldBlas>()->fieldLambdaOnEntities(
819 print_ents, "VELOCITIES", &ents);
820 CHKERR m_field.getInterface<FieldBlas>()->fieldLambdaOnEntities(
821 print_ents, "DISPLACEMENTS", &ents);
822 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::ifrom);
823 }
824 * \endcode
825 *
826 * @param reg_exp_name
827 * @return std::vector<const CubitMeshSets *>
828 */
829 std::vector<const CubitMeshSets *>
830 getCubitMeshsetPtr(const std::regex reg_exp_name) const;
831
832 /**
833 * \brief get entities from CUBIT/meshset of a particular entity dimension
834 * \ingroup mofem_meshset_mng
835
836 * Nodeset can contain nodes, edges, triangles and tets. This applies to
837 other meshsets too.
838 * The nodeset's meshset contain the nodes in the MIDDLE of the surface or
839 volume which is done by default in Cubit,
840 * Hence if all nodes on a particular nodeset are required,
841 * one should get all triangles or tetrahedrons for which the nodeset was
842 create in Cubit,
843 * and get all the connectivities of tris/tets.
844
845 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
846 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
847 * \param dimensions (0 - Nodes, 1 - Edges, 2 - Faces, 3 -
848 Volume(tetrahedral))
849 * \param Range containing the retrieved entities
850 * \param recursive If true, meshsets containing meshsets are queried
851 recursively. Returns the contents of meshsets, but not the meshsets
852 themselves if true.
853 */
854 MoFEMErrorCode getEntitiesByDimension(const int ms_id,
855 const unsigned int cubit_bc_type,
856 const int dimension, Range &entities,
857 const bool recursive = true) const;
858
859 /**
860 * \brief get entities related to CUBIT/meshset,
861 * \ingroup mofem_meshset_mng
862
863 * NODESET will get Vertices only, even if the NODESET contains edges, tris
864 and tets
865 * SIDESET will get Tris, BLOCKSET will get Tets, DISPLACEMENTSET and
866 FORCESET are stored in NODESET, PRESSURESET is stored in Sideset.
867
868 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
869 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
870 * \param Range containing the retrieved entities related to the
871 * \param recursive If true, meshsets containing meshsets are queried
872 recursively. Returns the contents of meshsets, but not the meshsets
873 themselves if true.
874 */
875 MoFEMErrorCode getEntitiesByDimension(const int ms_id,
876 const unsigned int cubit_bc_type,
877 Range &entities,
878 const bool recursive = true) const;
879
880 /**
881 * \ingroup mofem_meshset_mng
882 * \brief get meshset from CUBIT Id and CUBIT type
883 *
884 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
885 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
886 * \param meshset where to store the retrieved entities
887 */
888 MoFEMErrorCode getMeshset(const int ms_id, const unsigned int cubit_bc_type,
889 EntityHandle &meshset) const;
890
891 /**
892 * @brief Check if meshset constains entities
893 *
894 * @param ms_id
895 * @param cubit_bc_type
896 * @param entities
897 * @param num_entities
898 * @param operation_type
899 * @return true
900 * @return false
901 */
902 bool checkIfMeshsetContainsEntities(
903 const int ms_id, const unsigned int cubit_bc_type,
904 const EntityHandle *entities, int num_entities,
905 const int operation_type = moab::Interface::INTERSECT);
906
907 /**
908 * \ingroup mofem_meshset_mng
909 * \brief get all CUBIT meshsets by CUBIT type
910 *
911 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more).
912 * \param meshsets is range of meshsets
913 */
914 MoFEMErrorCode getMeshsetsByType(const unsigned int cubit_bc_type,
915 Range &meshsets) const;
916
917 /**
918 * \brief add blocksets reading config file
919
920 Example of config file
921 \code
922
923 [block_1001]
924
925 # Example applying attributes to blockset
926
927 id=2001
928 add=BLOCKSET
929 user1=1.0 # attribute value 1
930 user2=2.0 # you can set up to 10 attributes (if needed could be easily
931 extended to more, let us know)
932 user3=3.0
933
934 [block_1002]
935
936 # Example applying material block (isotropic elastic material)
937
938 id=2002
939 add=BLOCKSET
940 name=MAT_ELASTIC
941 young=10
942 poisson=0.25
943 thermalexpansion=0
944
945 [block_1003]
946
947 # Example applying displacement constrains
948
949 id=2003
950 add=NODESET
951
952 # Each flag means that boundary consition on displacements is set.
953 disp_flag1=1 # Setting constrains in x- direction
954 disp_flag2=1 # Setting constrains in y- direction
955 disp_flag3=1 # Setting constrains in z- direction
956 disp_flag4=1 # Setting constrains on rotation over x- axis
957 disp_flag5=1 # Setting constrains on rotation over y- axis
958 disp_flag6=1 # Setting constrains on rotation over z-axis
959 disp_ux=1 # value of disp in x- direction
960 disp_uy=2
961 disp_uz=3
962 disp_rx=4 # value of rotation in y-direction
963 disp_ry=5
964 disp_rz=6
965
966 # Note above values could be interpreted differently if needed.
967
968 [block_1004]
969
970 # Example applying force boundary conditions
971
972 id=2004
973 add=NODESET
974 force_magnitude=1
975 moment_magnitude=1
976 force_fx=1
977 force_fy=1
978 force_fz=1
979 moment_mx=1
980 moment_my=1
981 moment_mz=1
982
983 [block_1005]
984
985 # Example applying pressure boundary conditions
986
987 id=2005
988 add=SIDESET
989 pressure_flag2=1 # 0: Pressure is interpreted as pure pressure 1:
990 pressure is interpreted as total force
991 pressure_magnitude=1
992
993 # Example applying temperature boundary conditions
994
995 [block_1006]
996
997 id=2006
998 add=NODESET
999 temperature_flag1=1 # 0: N/A, 1: temperature value applied
1000 temperature_t=1
1001
1002 [block_1007]
1003
1004 id=2007
1005 add=SIDESET
1006 heatflux_flag1=1 # 0: N/A, 1: heat flux applied
1007 heatflux_magnitude=1
1008
1009 [block_1008]
1010
1011 # Example applying material block (isotropic thermal material)
1012
1013 id=2008
1014 add=BLOCKSET
1015 name=MAT_THERMAL # Hast to be set for Thermal Mat
1016 conductivity=1
1017 capacity=1
1018
1019 [block_1009]
1020
1021 # Example applying interface
1022 id=2009
1023 add=SIDESET
1024 interface_type=1
1025
1026 [block_1010]
1027
1028 # Example applying material block for interface element
1029
1030 id=2010
1031 add=BLOCKSET
1032 name=MAT_INTERF
1033 interface_alpha = 1
1034 interface_beta = 0
1035 interface_ft = 1
1036 interface_Gf = 1
1037
1038
1039 [block_1009]
1040
1041 # Example applying material block (isotropic trans iso material)
1042
1043 id=2011
1044 add=BLOCKSET
1045 name=MAT_ELASTIC_TRANS_ISO
1046 Youngp=1
1047 Youngz=2
1048 Poissonp=3
1049 Poissonpz=4
1050 Shearzp=5
1051
1052 [SET_ATTR_foo]
1053
1054 # Example set atttributes to block name "foo"
1055 number_of_attributes=3
1056 user1=1
1057 user2=2
1058 user3=3
1059
1060 \endcode
1061
1062 * @param file_name path to configuration file containing meshset definitions
1063 * @param clean_file_options whether to clean existing file options before loading
1064 * @return MoFEMErrorCode Error code indicating success or failure
1065 */
1066 MoFEMErrorCode setMeshsetFromFile(const string file_name,
1067 const bool clean_file_options = true);
1068
1069 /**
1070 * \brief Load meshset configuration from command line specified file
1071 * \ingroup mofem_meshset_mng
1072 *
1073 * Reads the configuration file name from the command line option
1074 * '-meshsets_config' and loads meshset definitions from that file.
1075 * This provides a convenient way to specify meshset configurations
1076 * at runtime without hardcoding file paths.
1077 *
1078 * Command line usage: -meshsets_config filename.cfg
1079 *
1080 * @return MoFEMErrorCode Error code indicating success or failure
1081 */
1082 MoFEMErrorCode setMeshsetFromFile();
1083
1084 /**
1085 * @brief save cubit meshset entities on the moab mesh
1086 *
1087 * @param ms_id id of the cubit meshset (NODESET SIDESET BLOCKSET)
1088 * @param cubit_bc_type type of a cubit mesheset
1089 * @param file_name optional name for the file
1090 * @param file_type optional file type for moab (VTK MOAB)
1091 * @param options optional parameters for moab writer (PARALLEL=WRITE_PART)
1092 * @return MoFEMErrorCode
1093 */
1095 saveMeshsetToFile(const int ms_id, const unsigned int cubit_bc_type,
1096 const std::string file_name = "out_meshset.vtk",
1097 const std::string file_type = "VTK",
1098 const std::string options = "") const;
1099
1100 /**
1101 * @brief save cubit meshset entities on the moab mesh
1102 *
1103 * @param ms_id id of the cubit meshset
1104 * @param cubit_bc_type type of a cubit mesheset (NODESET SIDESET BLOCKSET)
1105 * @param dim dimension of the entities
1106 * @param file_name optional name for the file
1107 * @param file_type optional file type for moab (VTK MOAB)
1108 * @param options optional parameters for moab writer (PARALLEL=WRITE_PART)
1109 * @return MoFEMErrorCode
1110 */
1111 MoFEMErrorCode saveMeshsetToFile(
1112 const int ms_id, const unsigned int cubit_bc_type, const int dim,
1113 const std::string file_name = "out_meshset.vtk",
1114 const bool recursive = false, const std::string file_type = "VTK",
1115 const std::string options = "") const;
1116
1117 /**
1118 * \brief Get config file options, use with care
1119 * @return error code
1120 */
1121 inline boost::shared_ptr<boost::program_options::options_description> &
1122 getConfigFileOptionsPtr() {
1123 return configFileOptionsPtr;
1124 }
1125
1126 /**
1127 * @brief Update all blocksets, sidesets and node sets
1128 *
1129 * @param bit
1130 * @return MoFEMErrorCode
1131 */
1132 MoFEMErrorCode updateAllMeshsetsByEntitiesChildren(const BitRefLevel &bit);
1133
1134 static bool broadcastMeshsetsOn; ///< if true meshsets are synchronised
1135 ///< between processors
1136
1137 static void sortMeshsets(std::vector<const CubitMeshSets *> &vec_ptr);
1138
1139protected:
1140 Tag nsTag;
1141 Tag ssTag;
1142 Tag nsTag_data;
1143 Tag ssTag_data;
1144 Tag bhTag;
1145 Tag bhTag_header;
1146
1147 // cubit
1148 CubitMeshSet_multiIndex cubitMeshsets; ///< cubit meshsets
1149 boost::shared_ptr<boost::program_options::options_description>
1150 configFileOptionsPtr; ///< config file options
1151
1152};
1153
1154template <class CUBIT_BC_DATA_TYPE>
1155MoFEMErrorCode MeshsetsManager::printBcSet(CUBIT_BC_DATA_TYPE &data,
1156 unsigned long int type) const {
1158 const MoFEM::Interface &m_field = cOre;
1159 const moab::Interface &moab = m_field.get_moab();
1160 for (auto it : getCubitMeshsetPtr(type)) {
1161 CHKERR it->getBcDataStructure(data);
1162 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *it;
1163 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << data;
1164 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << "name " << it->getName();
1165 for (EntityType t = MBVERTEX; t != MBENTITYSET; ++t) {
1166 int nb;
1167 CHKERR moab.get_number_entities_by_type(it->meshset, t, nb, true);
1168 if (nb > 0) {
1169 MOFEM_LOG("MeshsetMngSync", Sev::inform)
1170 << "msId " << it->getMeshsetId() << " number of "
1171 << moab::CN::EntityTypeName(t) << " " << nb;
1172 }
1173 }
1174 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::inform);
1175 }
1177}
1178
1179} // namespace MoFEM
1180
1181#endif //__MESHSETSMANAGER_HPP__
1182
1183/**
1184 * \defgroup mofem_meshset_mng MeshsetsManager
1185 * \brief Interface for meshsets with entities with data and boundary conditions
1186 *
1187 * \ingroup mofem
1188 **/
#define MOFEM_LOG_SEVERITY_SYNC(comm, severity)
Synchronise "SYNC" on curtain severity level.
@ DEFAULT_VERBOSITY
MoFEMTypes
Those types control how functions respond on arguments, f.e. error handling.
@ MF_EXIST
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define DEPRECATED
Definition definitions.h:17
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MOFEM_LOG(channel, severity)
Log.
auto bit
set bit
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
multi_index_container< CubitMeshSets, indexed_by< hashed_unique< tag< Meshset_mi_tag >, member< CubitMeshSets, EntityHandle, &CubitMeshSets::meshset > >, ordered_non_unique< tag< CubitMeshsetType_mi_tag >, const_mem_fun< CubitMeshSets, unsigned long int, &CubitMeshSets::getBcTypeULong > >, ordered_non_unique< tag< CubitMeshsetMaskedType_mi_tag >, const_mem_fun< CubitMeshSets, unsigned long int, &CubitMeshSets::getMaskedBcTypeULong > >, ordered_non_unique< tag< CubitMeshsets_name >, const_mem_fun< CubitMeshSets, std::string, &CubitMeshSets::getName > >, hashed_unique< tag< Composite_Cubit_msId_And_MeshsetType_mi_tag >, composite_key< CubitMeshSets, const_mem_fun< CubitMeshSets, int, &CubitMeshSets::getMeshsetId >, const_mem_fun< CubitMeshSets, unsigned long int, &CubitMeshSets::getMaskedBcTypeULong > > > > > CubitMeshSet_multiIndex
Stores data about meshsets (see CubitMeshSets) storing data about boundary conditions,...
constexpr double t
plate stiffness
Definition plate.cpp:58
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
Core (interface) class.
Definition Core.hpp:82
Deprecated interface functions.

◆ _IT_CUBITMESHSETS_BY_NAME_FOR_LOOP_

#define _IT_CUBITMESHSETS_BY_NAME_FOR_LOOP_ (   MESHSET_MANAGER,
  NAME,
  IT 
)

#include <src/interfaces/MeshsetsManager.hpp>

Value:
CubitMeshsetByName::iterator IT = \
MESHSET_MANAGER.get_meshsets_manager_ptr()->getBegin(NAME); \
IT != MESHSET_MANAGER.get_meshsets_manager_ptr()->getEnd(NAME); \
IT++

Iterator that loops over Cubit BlockSet having a particular name.

Parameters
MESHSET_MANAGERmeshset manager (works as well with Interface)
NAMEname
ITiterator

Example:

for(_IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(mField,"SOME_BLOCK_NAME",it) {
...
}
#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.

Definition at line 117 of file MeshsetsManager.hpp.

◆ _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_

#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_ (   MESHSET_MANAGER,
  CUBITBCTYPE,
  IT 
)

#include <src/interfaces/MeshsetsManager.hpp>

Value:
CubitMeshsetByMask::iterator IT = \
MESHSET_MANAGER.get_meshsets_manager_ptr()->getBySetTypeBegin( \
CUBITBCTYPE); \
IT != MESHSET_MANAGER.get_meshsets_manager_ptr()->getBySetTypeEnd( \
CUBITBCTYPE); \
IT++

Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.

Parameters
MESHSET_MANAGERmeshset manager (works as well with Interface)
seeCubitBC (NODESET, SIDESET or BLOCKSET and more)
iterator

Example:

Examples
mofem/atom_tests/add_cubit_meshsets.cpp, mofem/atom_tests/continuity_check_on_contact_prism_side_ele.cpp, mofem/atom_tests/cubit_bc_test.cpp, mofem/atom_tests/forces_and_sources_testing_flat_prism_element.cpp, mofem/atom_tests/mesh_insert_interface_atom.cpp, mofem/tools/extrude_prisms.cpp, mofem/tools/mesh_cut.cpp, mofem/tutorials/clx-0/helmholtz.cpp, mofem/tutorials/cor-0to1/src/UnsaturatedFlow.hpp, mofem/tutorials/cor-0to1/unsaturated_transport.cpp, mofem/tutorials/cor-10/navier_stokes.cpp, mofem/tutorials/max-0/src/MagneticElement.hpp, mofem/tutorials/scl-10/initial_diffusion.cpp, mofem/tutorials/scl-10/photon_diffusion.cpp, mofem/tutorials/scl-12/electrostatics.cpp, mofem/users_modules/basic_finite_elements/elasticity/elasticity.cpp, and mofem/users_modules/bone_remodelling/src/impl/Remodeling.cpp.

Definition at line 94 of file MeshsetsManager.hpp.

◆ _IT_CUBITMESHSETS_FOR_LOOP_

#define _IT_CUBITMESHSETS_FOR_LOOP_ (   MESHSET_MANAGER,
  IT 
)

#include <src/interfaces/MeshsetsManager.hpp>

Value:
CubitMeshSet_multiIndex::iterator IT = \
MESHSET_MANAGER.get_meshsets_manager_ptr()->getBegin(); \
IT != MESHSET_MANAGER.get_meshsets_manager_ptr()->getEnd(); \
IT++

Iterator that loops over all the Cubit MeshSets in a moFEM field.

Parameters
MESHSET_MANAGERmeshset manager (works as well with Interface)
iterator
Examples
mofem/atom_tests/add_cubit_meshsets.cpp, mofem/atom_tests/continuity_check_on_contact_prism_side_ele.cpp, mofem/atom_tests/forces_and_sources_testing_flat_prism_element.cpp, mofem/atom_tests/mesh_insert_interface_atom.cpp, mofem/tools/split_sideset.cpp, mofem/tutorials/cor-0to1/unsaturated_transport.cpp, and mofem/users_modules/bone_remodelling/bone_adaptation.cpp.

Definition at line 57 of file MeshsetsManager.hpp.

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 
)

#include <src/interfaces/MeshsetsManager.hpp>

Add entities to CUBIT meshset (array version)

Adds an array of mesh entities to an existing meshset. This version accepts entities as a C-style array with explicit count.

Parameters
cubit_bc_typetype of meshset (NODESET, SIDESET, BLOCKSET, etc.)
ms_idCUBIT ID of the target meshset
entspointer to array of entity handles
nb_entsnumber of entities in the array
Returns
MoFEMErrorCode Error code indicating success or failure

Definition at line 449 of file MeshsetsManager.cpp.

451 {
452 Interface &m_field = cOre;
453 moab::Interface &moab = m_field.get_moab();
455 auto cit =
456 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
457 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
458 if (cit ==
459 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
460 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
461 "Cannot find Cubit meshset with id: %d", ms_id);
462 }
463 EntityHandle meshset = cit->getMeshset();
464 CHKERR moab.add_entities(meshset, ents, nb_ents);
465
467}
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
DeprecatedCoreInterface Interface
moab::Interface & get_moab()
Definition Core.hpp:322
CubitMeshSet_multiIndex cubitMeshsets
cubit meshsets
MoFEM::Core & cOre
Reference to MoFEM Core interface.

◆ addEntitiesToMeshset() [2/2]

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

#include <src/interfaces/MeshsetsManager.hpp>

Add entities to CUBIT meshset.

Adds a range of mesh entities to an existing meshset. The entities become part of the meshset for subsequent operations like applying boundary conditions or material properties.

Parameters
cubit_bc_typetype of meshset (NODESET, SIDESET, BLOCKSET, etc.)
ms_idCUBIT ID of the target meshset
entsrange of entities to add to the meshset
Returns
MoFEMErrorCode Error code indicating success or failure
Examples
mofem/tools/mesh_cut.cpp.

Definition at line 429 of file MeshsetsManager.cpp.

430 {
431 Interface &m_field = cOre;
432 moab::Interface &moab = m_field.get_moab();
434 auto cit =
435 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
436 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
437 if (cit ==
438 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
439 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
440 "Cannot find Cubit meshset with id: %d", ms_id);
441 }
442 EntityHandle meshset = cit->getMeshset();
443 CHKERR moab.add_entities(meshset, ents);
444
446}

◆ addMeshset()

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

#include <src/interfaces/MeshsetsManager.hpp>

Add CUBIT meshset to manager.

Creates a new meshset entry in the manager's database with the specified CUBIT type and ID. The meshset can be given an optional name for easier identification and access.

Parameters
cubit_bc_typetype of meshset (NODESET, SIDESET, BLOCKSET, etc.)
ms_idCUBIT ID for the meshset
nameoptional name for the meshset (empty string if not specified)
Returns
MoFEMErrorCode Error code indicating success or failure
Examples
mofem/atom_tests/add_cubit_meshsets.cpp, mofem/tools/mesh_cut.cpp, and mofem/users_modules/eshelbian_plasticity/src/impl/EshelbianPlasticity.cpp.

Definition at line 396 of file MeshsetsManager.cpp.

398 {
399 Interface &m_field = cOre;
400 moab::Interface &moab = m_field.get_moab();
402 if (checkMeshset(ms_id, cubit_bc_type)) {
403 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
404 "such cubit meshset is already there id = %d", ms_id);
405 }
406
407 CubitMeshSets cmeshset(moab, cubit_bc_type, ms_id);
408 if ((cmeshset.cubitBcType & CubitBCType(NODESET | SIDESET | BLOCKSET))
409 .any()) {
410 auto p = cubitMeshsets.insert(cmeshset);
411 if (!p.second) {
412 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
413 "meshset not inserted");
414 }
415 if (name.size() > 0) {
416 bool success =
417 cubitMeshsets.modify(p.first, CubitMeshSets_change_name(moab, name));
418 if (!success) {
419 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
420 "name to cubit meshset can not be set");
421 }
422 }
423 }
424
426}
@ SIDESET
@ BLOCKSET
@ MOFEM_OPERATION_UNSUCCESSFUL
Definition definitions.h:34
bool checkMeshset(const int ms_id, const CubitBCType cubit_bc_type) const
Check for CUBIT meshset by ID and type.
std::bitset< 32 > CubitBCType
Definition Types.hpp:52

◆ broadcastMeshsets()

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

#include <src/interfaces/MeshsetsManager.hpp>

Broadcast meshsets across MPI processes.

Synchronizes meshset information across all MPI processes to ensure consistent meshset data in parallel computations. Typically called after meshset modifications on specific processes.

Parameters
verbverbosity level for output
Returns
MoFEMErrorCode Error code indicating success or failure

Definition at line 129 of file MeshsetsManager.cpp.

129 {
130 Interface &m_field = cOre;
131 moab::Interface &moab = m_field.get_moab();
133
134 ParallelComm *pcomm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
135 if (pcomm == NULL)
136 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
137 "MOAB communicator not set");
138
139 const double coords[] = {0, 0, 0};
140
141 auto set_tags_dummy_node = [&](const EntityHandle dummy_node,
142 const EntityHandle meshset) {
144 std::vector<Tag> tag_handles;
145 CHKERR moab.tag_get_tags_on_entity(meshset, tag_handles);
146 for (auto th : tag_handles) {
147 void *data[1];
148 int tag_size;
149 CHKERR moab.tag_get_by_ptr(th, &meshset, 1, (const void **)data,
150 &tag_size);
151 if (tag_size > 0)
152 CHKERR moab.tag_set_by_ptr(th, &dummy_node, 1, data, &tag_size);
153 }
155 };
156
157 for (auto t : {NODESET, SIDESET, BLOCKSET}) {
158 std::vector<const CubitMeshSets *> vec_ptr;
159 for (auto &m : cubitMeshsets) {
160 if ((m.getBcType() & CubitBCType(t)).any()) {
161 vec_ptr.push_back(&m);
162 }
163 }
164 sortMeshsets(vec_ptr);
165
166 std::vector<EntityHandle> vec_meshsets;
167 vec_meshsets.reserve(vec_ptr.size());
168 for (auto m_ptr : vec_ptr) {
169 vec_meshsets.push_back(m_ptr->getMeshset());
170 }
171
172 switch (t) {
173 case NODESET:
174 MOFEM_LOG("MeshsetMngSync", Sev::verbose)
175 << "broadcast NODESET " << vec_meshsets.size();
176 break;
177 case SIDESET:
178 MOFEM_LOG("MeshsetMngSync", Sev::verbose)
179 << "broadcast SIDESET " << vec_meshsets.size();
180 break;
181 case BLOCKSET:
182 MOFEM_LOG("MeshsetMngSync", Sev::verbose)
183 << "broadcast BLOCKSET " << vec_meshsets.size();
184 break;
185 default:
186 MOFEM_LOG("MeshsetMngSync", Sev::verbose)
187 << "broadcast Unknown " << vec_meshsets.size();
188 }
189
190 for (int from_proc = 0; from_proc < pcomm->size(); ++from_proc) {
191
192 Range r_dummy_nodes;
193
194 if (from_proc == pcomm->rank()) {
195 std::vector<EntityHandle> dummy_nodes(vec_meshsets.size(), 0);
196 int i = 0;
197 for (auto m : vec_meshsets) {
198 CHKERR moab.create_vertex(coords, dummy_nodes[i]);
199 CHKERR set_tags_dummy_node(dummy_nodes[i], m);
200 ++i;
201 }
202 r_dummy_nodes.insert_list(dummy_nodes.begin(), dummy_nodes.end());
203 }
204
205 CHKERR pcomm->broadcast_entities(from_proc, r_dummy_nodes, false, true);
206
207 if (from_proc != pcomm->rank()) {
208
209 for (auto dummy_node : r_dummy_nodes) {
210 CubitMeshSets broadcast_block(moab, dummy_node);
211 auto id = broadcast_block.getMeshsetId();
212 if (id != -1) {
213 auto mit =
214 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>()
215 .find(boost::make_tuple(
216 id, broadcast_block.getMaskedBcTypeULong()));
217 if (mit ==
218 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>()
219 .end()) {
221 CHKERR moab.create_meshset(MESHSET_SET, m);
222 CHKERR set_tags_dummy_node(m, dummy_node);
223 auto hint = cubitMeshsets.end();
224 /*auto p = */ cubitMeshsets.emplace_hint(hint, moab, m);
225 }
226 } else {
227 MOFEM_LOG("MeshsetMngSync", Sev::warning)
228 << "broadcasted vertex " << dummy_node << " has negative id";
229 }
230
231 }
232
233 } else {
234 MOFEM_LOG("MeshsetMngSync", Sev::verbose)
235 << "broadcast send from " << from_proc;
236 }
237
238 CHKERR moab.delete_entities(r_dummy_nodes);
239 }
240
241 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::verbose);
242 }
243
245}
#define MYPCOMM_INDEX
default communicator number PCOMM
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'm', 3 > m
static void sortMeshsets(std::vector< const CubitMeshSets * > &vec_ptr)

◆ checkMeshset() [1/2]

bool MoFEM::MeshsetsManager::checkMeshset ( const int  ms_id,
const CubitBCType  cubit_bc_type 
) const

#include <src/interfaces/MeshsetsManager.hpp>

Check for CUBIT meshset by ID and type.

Verifies if a meshset with the specified CUBIT ID and type exists in the manager's database. Useful for validation before accessing meshset properties or entities.

Todo:
All cubit interface functions should be outsourced to dedicated interface
Parameters
ms_idCUBIT ID of the meshset (BLOCKSET/SIDESET/NODESET)
cubit_bc_typetype of meshset (NODESET, SIDESET, BLOCKSET, etc.)
Returns
bool true if meshset exists, false otherwise
Examples
mofem/tools/mesh_cut.cpp, mofem/tools/mesh_smoothing.cpp, mofem/tutorials/cor-9/reaction_diffusion.cpp, and mofem/tutorials/scl-6/heat_equation.cpp.

Definition at line 371 of file MeshsetsManager.cpp.

372 {
373 auto miit =
374 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
375 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
376 if (miit !=
377 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
378 return true;
379 }
380 return false;
381}

◆ checkMeshset() [2/2]

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

#include <src/interfaces/MeshsetsManager.hpp>

Check if meshset with given name exists.

Searches for meshsets by name and optionally returns the count of matching meshsets. Multiple meshsets can have the same name.

Parameters
namename of the meshset to search for
number_of_meshsets_ptroptional pointer to store count of matching meshsets
Returns
bool true if at least one meshset with the name exists, false otherwise

Definition at line 383 of file MeshsetsManager.cpp.

384 {
385 auto miit = cubitMeshsets.get<CubitMeshsets_name>().lower_bound(name);
386 auto hi_miit = cubitMeshsets.get<CubitMeshsets_name>().upper_bound(name);
387 if (std::distance(miit, hi_miit) == 0) {
388 return false;
389 }
390 if (number_of_meshsets_ptr) {
391 *number_of_meshsets_ptr = std::distance(miit, hi_miit);
392 }
393 return true;
394}

◆ clearMap()

MoFEMErrorCode MoFEM::MeshsetsManager::clearMap ( )

#include <src/interfaces/MeshsetsManager.hpp>

Clear the multi-index container.

Removes all stored meshset data from the internal container. Useful for reinitialization or memory cleanup.

Returns
MoFEMErrorCode Error code indicating success or failure

Definition at line 59 of file MeshsetsManager.cpp.

59 {
61 cubitMeshsets.clear();
63}
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...

◆ getBegin() [1/3]

CubitMeshSet_multiIndex::iterator MoFEM::MeshsetsManager::getBegin ( ) const
inline

#include <src/interfaces/MeshsetsManager.hpp>

get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)

for(IT_CUBITMESHSETS_FOR_LOOP(mField,it) { ... }

Definition at line 435 of file MeshsetsManager.hpp.

435 {
436 return cubitMeshsets.begin();
437 }

◆ getBegin() [2/3]

CubitMeshsetByName::iterator MoFEM::MeshsetsManager::getBegin ( const std::string &  name) const
inline

#include <src/interfaces/MeshsetsManager.hpp>

get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)

for(IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP(mField,NODESET|DISPLACEMENTSET,it) { ... }

Parameters
typeof meshset (NODESET, SIDESET or BLOCKSET and more)

Definition at line 543 of file MeshsetsManager.hpp.

543 {
544 return cubitMeshsets.get<CubitMeshsets_name>().lower_bound(name);
545 }

◆ getBegin() [3/3]

CubitMeshsetByType::iterator MoFEM::MeshsetsManager::getBegin ( const unsigned int  cubit_bc_type) const
inline

#include <src/interfaces/MeshsetsManager.hpp>

get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)

for(IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(mField,NODESET|DISPLACEMENTSET,it) { ... }

Parameters
typeof meshset (NODESET, SIDESET or BLOCKSET and more)

Definition at line 468 of file MeshsetsManager.hpp.

468 {
469 return cubitMeshsets.get<CubitMeshsetType_mi_tag>().lower_bound(
470 cubit_bc_type);
471 }

◆ getBySetTypeBegin()

CubitMeshsetByMask::iterator MoFEM::MeshsetsManager::getBySetTypeBegin ( const unsigned int  cubit_bc_type) const
inline

#include <src/interfaces/MeshsetsManager.hpp>

get end iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)

for(IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(mField,NODESET,it) { ... }

Parameters
typeof meshset (NODESET, SIDESET or BLOCKSET and more)

Definition at line 506 of file MeshsetsManager.hpp.

506 {
507 return cubitMeshsets.get<CubitMeshsetMaskedType_mi_tag>().lower_bound(
508 cubit_bc_type);
509 }

◆ getBySetTypeEnd()

CubitMeshsetByMask::iterator MoFEM::MeshsetsManager::getBySetTypeEnd ( const unsigned int  cubit_bc_type) const
inline

#include <src/interfaces/MeshsetsManager.hpp>

get end iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)

for(IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(mField,NODESET,it) { ... }

Parameters
typeof meshset (NODESET, SIDESET or BLOCKSET and more)

Definition at line 524 of file MeshsetsManager.hpp.

524 {
525 return cubitMeshsets.get<CubitMeshsetMaskedType_mi_tag>().upper_bound(
526 cubit_bc_type);
527 }

◆ getCubitMeshsetPtr() [1/7]

std::vector< const CubitMeshSets * > MoFEM::MeshsetsManager::getCubitMeshsetPtr ( const CubitBCType  cubit_bc_type) const

#include <src/interfaces/MeshsetsManager.hpp>

Get vector of pointer by bc type.

Returns
MoFEMErrorCode

Definition at line 649 of file MeshsetsManager.cpp.

649 {
650 std::vector<const CubitMeshSets *> vec_ptr;
651 CHK_MOAB_THROW(getCubitMeshsetPtr(cubit_bc_type, vec_ptr),
652 "Error in getting meshsets by name");
653 return vec_ptr;
654}
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
MoFEMErrorCode getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr) const
get cubit meshset

◆ getCubitMeshsetPtr() [2/7]

MoFEMErrorCode MoFEM::MeshsetsManager::getCubitMeshsetPtr ( const CubitBCType  cubit_bc_type,
std::vector< const CubitMeshSets * > &  vec_ptr 
) const

#include <src/interfaces/MeshsetsManager.hpp>

Get vector of pointer by bc type.

Parameters
std::vector<constCubitMeshSets *>
Returns
MoFEMErrorCode

Definition at line 635 of file MeshsetsManager.cpp.

637 {
639 auto r = cubitMeshsets.get<CubitMeshsetType_mi_tag>().equal_range(
640 cubit_bc_type.to_ulong());
641 for (auto it = r.first; it != r.second; ++it) {
642 vec_ptr.push_back(&*it);
643 }
644 sortMeshsets(vec_ptr);
646}
int r
Definition sdf.py:8

◆ getCubitMeshsetPtr() [3/7]

const CubitMeshSets * MoFEM::MeshsetsManager::getCubitMeshsetPtr ( const int  ms_id,
const CubitBCType  cubit_bc_type 
) const

#include <src/interfaces/MeshsetsManager.hpp>

get cubit meshset

Definition at line 608 of file MeshsetsManager.cpp.

609 {
610 const CubitMeshSets *cubit_meshset_ptr;
612 getCubitMeshsetPtr(ms_id, cubit_bc_type, &cubit_meshset_ptr),
613 "Get not get meshset");
614 return cubit_meshset_ptr;
615}
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.

◆ getCubitMeshsetPtr() [4/7]

MoFEMErrorCode MoFEM::MeshsetsManager::getCubitMeshsetPtr ( const int  ms_id,
const CubitBCType  cubit_bc_type,
const CubitMeshSets **  cubit_meshset_ptr 
) const

#include <src/interfaces/MeshsetsManager.hpp>

get cubit meshset

Examples
mofem/tutorials/adv-2/thermo_elastic.cpp, mofem/tutorials/adv-5/seepage.cpp, mofem/tutorials/vec-3/nonlinear_dynamic_elastic.cpp, mofem/tutorials/vec-7/adjoint.cpp, and mofem/users_modules/eshelbian_plasticity/src/impl/EshelbianPlasticity.cpp.

Definition at line 589 of file MeshsetsManager.cpp.

591 {
592 Interface &m_field = cOre;
594 auto miit =
595 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
596 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
597 if (miit !=
598 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
599 *cubit_meshset_ptr = &*miit;
600 } else {
601 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
602 "msId = %d is not there", ms_id);
603 }
605}

◆ getCubitMeshsetPtr() [5/7]

std::vector< const CubitMeshSets * > MoFEM::MeshsetsManager::getCubitMeshsetPtr ( const std::regex  reg_exp_name) const

#include <src/interfaces/MeshsetsManager.hpp>

Get vector of pointer to blocksets with name satisfying regular expression.

for (auto m :
(boost::format("%s(.*)") % block_name).str()
))
) {
MOFEM_LOG("WORLD", Sev::inform) << m->getName();
Range ents;
m_field.get_moab().get_entities_by_dimension(
m->getMeshset(), 0, ents, false);
auto print_ents = [](boost::shared_ptr<FieldEntity> ent_ptr) {
if(!(ent_ptr->getPStatus() & PSTATUS_NOT_OWNED)) {
MOFEM_LOG("SYNC", Sev::inform) << ent_ptr->getName() << ": " <<
ent_ptr->getEntFieldData();
}
};
CHKERR m_field.getInterface<FieldBlas>()->fieldLambdaOnEntities(
print_ents, "VELOCITIES", &ents);
CHKERR m_field.getInterface<FieldBlas>()->fieldLambdaOnEntities(
print_ents, "DISPLACEMENTS", &ents);
MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::ifrom);
}
Interface for managing meshsets containing materials and boundary conditions.
IFACE getInterface() const
Get interface pointer to pointer of interface.
Parameters
reg_exp_name
Returns
std::vector<const CubitMeshSets *>

Definition at line 673 of file MeshsetsManager.cpp.

673 {
674 std::vector<const CubitMeshSets *> vec_ptr;
675 CHK_MOAB_THROW(getCubitMeshsetPtr(reg_exp_name, vec_ptr),
676 "Error in getting meshsets by name");
677 return vec_ptr;
678}

◆ getCubitMeshsetPtr() [6/7]

MoFEMErrorCode MoFEM::MeshsetsManager::getCubitMeshsetPtr ( const std::regex  reg_exp_name,
std::vector< const CubitMeshSets * > &  vec_ptr 
) const

#include <src/interfaces/MeshsetsManager.hpp>

Get vector of pointer to blocksets with name satisfying regular expression.

Parameters
reg_exp_name
std::vector<constCubitMeshSets *>
Returns
MoFEMErrorCode

Definition at line 656 of file MeshsetsManager.cpp.

658 {
660 auto r =
661 cubitMeshsets.get<CubitMeshsetMaskedType_mi_tag>().equal_range(BLOCKSET);
662 for (; r.first != r.second; ++r.first) {
663 const auto name = r.first->getName();
664 if (std::regex_match(name, reg_exp_name)) {
665 vec_ptr.push_back(&*r.first);
666 }
667 }
668 sortMeshsets(vec_ptr);
670}

◆ getCubitMeshsetPtr() [7/7]

MoFEMErrorCode MoFEM::MeshsetsManager::getCubitMeshsetPtr ( const string  name,
const CubitMeshSets **  cubit_meshset_ptr 
) const

#include <src/interfaces/MeshsetsManager.hpp>

get cubit meshset

Definition at line 617 of file MeshsetsManager.cpp.

618 {
619 Interface &m_field = cOre;
621 auto miit = cubitMeshsets.get<CubitMeshsets_name>().lower_bound(name);
622 auto hi_miit = cubitMeshsets.get<CubitMeshsets_name>().upper_bound(name);
623 if (std::distance(miit, hi_miit) == 0) {
624 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
625 "meshset name <%s> is not there", name.c_str());
626 }
627 if (std::distance(miit, hi_miit) > 1) {
628 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
629 "more that one meshser of that name <%s>", name.c_str());
630 }
631 *cubit_meshset_ptr = &*miit;
633}

◆ getEnd() [1/3]

CubitMeshSet_multiIndex::iterator MoFEM::MeshsetsManager::getEnd ( ) const
inline

#include <src/interfaces/MeshsetsManager.hpp>

get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)

for(IT_CUBITMESHSETS_FOR_LOOP(mField,it) { ... }

Definition at line 449 of file MeshsetsManager.hpp.

449 {
450 return cubitMeshsets.end();
451 }

◆ getEnd() [2/3]

CubitMeshsetByName::iterator MoFEM::MeshsetsManager::getEnd ( const std::string &  name) const
inline

#include <src/interfaces/MeshsetsManager.hpp>

get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)

for(IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP(mField,NODESET|DISPLACEMENTSET,it) { ... }

Parameters
typeof meshset (NODESET, SIDESET or BLOCKSET and more)

Definition at line 561 of file MeshsetsManager.hpp.

561 {
562 return cubitMeshsets.get<CubitMeshsets_name>().upper_bound(name);
563 }

◆ getEnd() [3/3]

CubitMeshsetByType::iterator MoFEM::MeshsetsManager::getEnd ( const unsigned int  cubit_bc_type) const
inline

#include <src/interfaces/MeshsetsManager.hpp>

get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(MFIELD,CUBITBCTYPE,IT)

for(IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP(mField,NODESET|DISPLACEMENTSET,it) { ... }

Parameters
typeof meshset (NODESET, SIDESET or BLOCKSET and more)

Definition at line 488 of file MeshsetsManager.hpp.

488 {
489 return cubitMeshsets.get<CubitMeshsetType_mi_tag>().upper_bound(
490 cubit_bc_type);
491 }

◆ getEntitiesByDimension() [1/2]

MoFEMErrorCode MoFEM::MeshsetsManager::getEntitiesByDimension ( const int  ms_id,
const unsigned int  cubit_bc_type,
const int  dimension,
Range entities,
const bool  recursive = true 
) const

#include <src/interfaces/MeshsetsManager.hpp>

get entities from CUBIT/meshset of a particular entity dimension

Nodeset can contain nodes, edges, triangles and tets. This applies to other meshsets too. The nodeset's meshset contain the nodes in the MIDDLE of the surface or volume which is done by default in Cubit, Hence if all nodes on a particular nodeset are required, one should get all triangles or tetrahedrons for which the nodeset was create in Cubit, and get all the connectivities of tris/tets.

Parameters
ms_idid of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
seeCubitBC (NODESET, SIDESET or BLOCKSET and more)
dimensions(0 - Nodes, 1 - Edges, 2 - Faces, 3 - Volume(tetrahedral))
Rangecontaining the retrieved entities
recursiveIf true, meshsets containing meshsets are queried recursively. Returns the contents of meshsets, but not the meshsets themselves if true.
Examples
mofem/atom_tests/prism_elements_from_surface.cpp, and mofem/tools/mesh_cut.cpp.

Definition at line 680 of file MeshsetsManager.cpp.

682 {
683 Interface &m_field = cOre;
684 moab::Interface &moab = m_field.get_moab();
686 auto miit =
687 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
688 boost::make_tuple(msId, cubit_bc_type));
689 if (miit !=
690 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
691 CHKERR miit->getMeshsetIdEntitiesByDimension(moab, dimension, entities,
692 recursive);
693 } else {
694 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
695 "msId = %d is not there", msId);
696 }
698}

◆ getEntitiesByDimension() [2/2]

MoFEMErrorCode MoFEM::MeshsetsManager::getEntitiesByDimension ( const int  ms_id,
const unsigned int  cubit_bc_type,
Range entities,
const bool  recursive = true 
) const

#include <src/interfaces/MeshsetsManager.hpp>

get entities related to CUBIT/meshset,

NODESET will get Vertices only, even if the NODESET contains edges, tris and tets SIDESET will get Tris, BLOCKSET will get Tets, DISPLACEMENTSET and FORCESET are stored in NODESET, PRESSURESET is stored in Sideset.

Parameters
ms_idid of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
seeCubitBC (NODESET, SIDESET or BLOCKSET and more)
Rangecontaining the retrieved entities related to the
recursiveIf true, meshsets containing meshsets are queried recursively. Returns the contents of meshsets, but not the meshsets themselves if true.

Definition at line 700 of file MeshsetsManager.cpp.

702 {
703 Interface &m_field = cOre;
704 moab::Interface &moab = m_field.get_moab();
706 auto miit =
707 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
708 boost::make_tuple(ms_id, cubit_bc_type));
709 if (miit !=
710 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
711 CHKERR miit->getMeshsetIdEntitiesByDimension(moab, entities, recursive);
712 } else {
713 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
714 "ms_id = %d is not there", ms_id);
715 }
717}

◆ getMeshset()

MoFEMErrorCode MoFEM::MeshsetsManager::getMeshset ( const int  ms_id,
const unsigned int  cubit_bc_type,
EntityHandle meshset 
) const

#include <src/interfaces/MeshsetsManager.hpp>

get meshset from CUBIT Id and CUBIT type

Parameters
ms_idid of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
seeCubitBC (NODESET, SIDESET or BLOCKSET and more)
meshsetwhere to store the retrieved entities
Examples
mofem/tools/mesh_cut.cpp, and mofem/tutorials/vec-5/free_surface.cpp.

Definition at line 719 of file MeshsetsManager.cpp.

721 {
722 Interface &m_field = cOre;
724 auto miit =
725 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
726 boost::make_tuple(ms_id, cubit_bc_type));
727 if (miit !=
728 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
729 meshset = miit->meshset;
730 } else {
731 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
732 "ms_id = %d is not there", ms_id);
733 }
735}

◆ getMeshsetsByType()

MoFEMErrorCode MoFEM::MeshsetsManager::getMeshsetsByType ( const unsigned int  cubit_bc_type,
Range meshsets 
) const

#include <src/interfaces/MeshsetsManager.hpp>

get all CUBIT meshsets by CUBIT type

Parameters
seeCubitBC (NODESET, SIDESET or BLOCKSET and more).
meshsetsis range of meshsets

Definition at line 753 of file MeshsetsManager.cpp.

754 {
756 auto miit =
757 cubitMeshsets.get<CubitMeshsetType_mi_tag>().lower_bound(cubit_bc_type);
758 auto hi_miit =
759 cubitMeshsets.get<CubitMeshsetType_mi_tag>().upper_bound(cubit_bc_type);
760 for (; miit != hi_miit; miit++) {
761 meshsets.insert(miit->meshset);
762 }
764}

◆ getTags() [1/2]

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

#include <src/interfaces/MeshsetsManager.hpp>

Get tag handles used on meshsets.

Retrieves MOAB tag handles for meshset identification and data storage. These tags follow CUBIT/MOAB conventions for nodesets, sidesets, and blocksets. The function initializes internal tag handles for subsequent meshset operations.

Parameters
verbverbosity level for output (-1 = default, higher values = more verbose)
Returns
MoFEMErrorCode Error code indicating success or failure

Definition at line 247 of file MeshsetsManager.cpp.

247 {
249 Interface &m_field = cOre;
250 moab::Interface &moab = m_field.get_moab();
252 bhTag_header, verb);
254}
MoFEMErrorCode getTags(int verb=-1)
Get tag handles used on meshsets.

◆ getTags() [2/2]

MoFEMErrorCode MoFEM::MeshsetsManager::getTags ( moab::Interface &  moab,
Tag nsTag,
Tag ssTag,
Tag nsTag_data,
Tag ssTag_data,
Tag bhTag,
Tag bhTag_header,
int  verb = -1 
)
static

#include <src/interfaces/MeshsetsManager.hpp>

Static version of getTags for external MOAB interface.

Parameters
moabreference to MOAB interface
nsTagreference to store nodeset tag handle
ssTagreference to store sideset tag handle
nsTag_datareference to store nodeset data tag handle
ssTag_datareference to store sideset data tag handle
bhTagreference to store blockset tag handle
bhTag_headerreference to store blockset header tag handle
verbverbosity level for output
Returns
MoFEMErrorCode Error code indicating success or failure

Definition at line 256 of file MeshsetsManager.cpp.

259 {
261
262 int default_val = -1;
263 CHKERR moab.tag_get_handle(DIRICHLET_SET_TAG_NAME, 1, MB_TYPE_INTEGER, nsTag,
264 MB_TAG_SPARSE | MB_TAG_CREAT, &default_val);
265
266 CHKERR moab.tag_get_handle(NEUMANN_SET_TAG_NAME, 1, MB_TYPE_INTEGER, ssTag,
267 MB_TAG_SPARSE | MB_TAG_CREAT, &default_val);
268
269 const int def_bc_data_len = 0;
270 std::string tag_name = std::string(DIRICHLET_SET_TAG_NAME) + "__BC_DATA";
271 CHKERR moab.tag_get_handle(
272 tag_name.c_str(), def_bc_data_len, MB_TYPE_OPAQUE, nsTag_data,
273 MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES | MB_TAG_VARLEN, NULL);
274
275 tag_name = std::string(NEUMANN_SET_TAG_NAME) + "__BC_DATA";
276 CHKERR moab.tag_get_handle(
277 tag_name.c_str(), def_bc_data_len, MB_TYPE_OPAQUE, ssTag_data,
278 MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES | MB_TAG_VARLEN, NULL);
279
280 CHKERR moab.tag_get_handle(MATERIAL_SET_TAG_NAME, 1, MB_TYPE_INTEGER, bhTag,
281 MB_TAG_SPARSE | MB_TAG_CREAT, &default_val);
282
283 std::vector<unsigned int> def_uint_zero(3, 0);
284 CHKERR moab.tag_get_handle(
285 BLOCK_HEADER, 3 * sizeof(unsigned int), MB_TYPE_INTEGER, bhTag_header,
286 MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES, &def_uint_zero[0]);
287
288 Tag block_attribs;
289 int def_Block_Attributes_length = 0;
290 CHKERR moab.tag_get_handle(
291 BLOCK_ATTRIBUTES, def_Block_Attributes_length, MB_TYPE_DOUBLE,
292 block_attribs, MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_VARLEN, NULL);
293
294 Tag entity_name_tag;
295 CHKERR moab.tag_get_handle(NAME_TAG_NAME, NAME_TAG_SIZE, MB_TYPE_OPAQUE,
296 entity_name_tag, MB_TAG_SPARSE | MB_TAG_CREAT);
297
299}

◆ initialiseDatabaseFromMesh()

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

#include <src/interfaces/MeshsetsManager.hpp>

Initialize container from mesh data.

Reads meshset information from the mesh database and populates the internal multi-index container. This includes discovering nodesets, sidesets, and blocksets with their associated tags and data.

Parameters
verbverbosity level for output
Returns
MoFEMErrorCode Error code indicating success or failure

Definition at line 65 of file MeshsetsManager.cpp.

65 {
66 Interface &m_field = cOre;
68 CHKERR readMeshsets(verb);
71
72 std::vector<const CubitMeshSets *> vec_ptr;
73 for (auto &m : cubitMeshsets) {
74 vec_ptr.push_back(&m);
75 }
76 sortMeshsets(vec_ptr);
77
78 for (auto m_ptr : vec_ptr) {
79 MOFEM_LOG("MeshsetMngWorld", Sev::inform)
80 << "meshset in database " << *m_ptr;
81 }
82 // Verbose synchronised print
83 for (auto m_ptr : vec_ptr) {
84 MOFEM_LOG("MeshsetMngSync", Sev::verbose)
85 << "meshset in database " << *m_ptr;
86 }
87 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::verbose);
88
90}
MoFEMErrorCode broadcastMeshsets(int verb=DEFAULT_VERBOSITY)
Broadcast meshsets across MPI processes.
MoFEMErrorCode readMeshsets(int verb=DEFAULT_VERBOSITY)
Read meshsets from mesh database.

◆ printDisplacementSet()

MoFEMErrorCode MoFEM::MeshsetsManager::printDisplacementSet ( ) const

#include <src/interfaces/MeshsetsManager.hpp>

Print meshsets with displacement boundary conditions.

Outputs information about all meshsets containing displacement boundary condition data, including constraint flags and prescribed values.

Returns
MoFEMErrorCode Error code indicating success or failure
Examples
mofem/tutorials/cor-7/elasticity_mixed_formulation.cpp, and mofem/users_modules/basic_finite_elements/elasticity/elasticity.cpp.

Definition at line 301 of file MeshsetsManager.cpp.

301 {
302 DisplacementCubitBcData mydata;
304 CHKERR printBcSet(mydata, NODESET | mydata.tYpe.to_ulong());
306}
MoFEMErrorCode printBcSet(CUBIT_BC_DATA_TYPE &data, unsigned long int type) const

◆ printForceSet()

MoFEMErrorCode MoFEM::MeshsetsManager::printForceSet ( ) const

#include <src/interfaces/MeshsetsManager.hpp>

Print meshsets with force boundary conditions.

Outputs information about all meshsets containing force boundary condition data, including force and moment components.

Returns
MoFEMErrorCode Error code indicating success or failure
Examples
mofem/tutorials/cor-7/elasticity_mixed_formulation.cpp, and mofem/users_modules/basic_finite_elements/elasticity/elasticity.cpp.

Definition at line 315 of file MeshsetsManager.cpp.

315 {
316 ForceCubitBcData mydata;
318 CHKERR printBcSet(mydata, NODESET | mydata.tYpe.to_ulong());
320}

◆ printHeatFluxSet()

MoFEMErrorCode MoFEM::MeshsetsManager::printHeatFluxSet ( ) const

#include <src/interfaces/MeshsetsManager.hpp>

Print meshsets with heat flux boundary conditions.

Outputs information about all meshsets containing heat flux boundary condition data, including flux magnitudes and directions.

Returns
MoFEMErrorCode Error code indicating success or failure

Definition at line 329 of file MeshsetsManager.cpp.

329 {
330 HeatFluxCubitBcData mydata;
332 CHKERR printBcSet(mydata, SIDESET | mydata.tYpe.to_ulong());
334}

◆ printMaterialsSet()

MoFEMErrorCode MoFEM::MeshsetsManager::printMaterialsSet ( ) const

#include <src/interfaces/MeshsetsManager.hpp>

Print meshsets with material properties.

Outputs information about all meshsets containing material data, including material parameters and constitutive model information.

Returns
MoFEMErrorCode Error code indicating success or failure
Examples
mofem/tutorials/cor-7/elasticity_mixed_formulation.cpp, and mofem/users_modules/basic_finite_elements/elasticity/elasticity.cpp.

Definition at line 336 of file MeshsetsManager.cpp.

336 {
338 const Interface &m_field = cOre;
339 const moab::Interface &moab = m_field.get_moab();
341 (*this), BLOCKSET | MAT_ELASTICSET, it)) {
342 Mat_Elastic data;
343 CHKERR it->getAttributeDataStructure(data);
344 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *it;
345 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << data;
346 Range tets;
347 CHKERR moab.get_entities_by_dimension(it->meshset, 3, tets, true);
348 MOFEM_LOG("MeshsetMngWorld", Sev::inform)
349 << "MAT_ELATIC msId " << it->getMeshsetId() << " nb. volumes "
350 << tets.size();
351 }
352
354 m_field, BLOCKSET | MAT_THERMALSET, it)) {
355 Mat_Thermal data;
356 CHKERR it->getAttributeDataStructure(data);
357 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *it;
358 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << data;
359 }
360
362 m_field, BLOCKSET | MAT_MOISTURESET, it)) {
363 Mat_Moisture data;
364 CHKERR it->getAttributeDataStructure(data);
365 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *it;
366 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << data;
367 }
369}
@ MAT_ELASTICSET
block name is "MAT_ELASTIC"
@ MAT_THERMALSET
block name is "MAT_THERMAL"
@ MAT_MOISTURESET
block name is "MAT_MOISTURE"
#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

#include <src/interfaces/MeshsetsManager.hpp>

Print meshsets with pressure boundary conditions.

Outputs information about all meshsets containing pressure boundary condition data, including pressure magnitudes and application flags.

Returns
MoFEMErrorCode Error code indicating success or failure

Definition at line 308 of file MeshsetsManager.cpp.

308 {
309 PressureCubitBcData mydata;
311 CHKERR printBcSet(mydata, SIDESET | mydata.tYpe.to_ulong());
313}

◆ printTemperatureSet()

MoFEMErrorCode MoFEM::MeshsetsManager::printTemperatureSet ( ) const

#include <src/interfaces/MeshsetsManager.hpp>

Print meshsets with temperature boundary conditions.

Outputs information about all meshsets containing temperature boundary condition data, including prescribed temperature values.

Returns
MoFEMErrorCode Error code indicating success or failure

Definition at line 322 of file MeshsetsManager.cpp.

322 {
323 TemperatureCubitBcData mydata;
325 CHKERR printBcSet(mydata, NODESET | mydata.tYpe.to_ulong());
327}

◆ readMeshsets()

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

#include <src/interfaces/MeshsetsManager.hpp>

Read meshsets from mesh database.

Scans the mesh for existing meshsets and populates the manager's internal data structures. This is typically called after mesh loading to discover all available nodesets, sidesets, and blocksets.

Parameters
verbverbosity level for output
Returns
MoFEMErrorCode Error code indicating success or failure

Definition at line 92 of file MeshsetsManager.cpp.

92 {
93 Interface &m_field = cOre;
94 moab::Interface &moab = m_field.get_moab();
96
97 Range meshsets;
98 CHKERR moab.get_entities_by_type(0, MBENTITYSET, meshsets, false);
99 for (auto m : meshsets) {
100 // check if meshset is cubit meshset
101 CubitMeshSets block(moab, m);
102 if ((block.cubitBcType & CubitBCType(NODESET | SIDESET | BLOCKSET)).any()) {
103 auto p = cubitMeshsets.insert(block);
104 if (!p.second) {
105 // blockset/nodeset/sideset set exist, could be created on other
106 // processor.
107 Range ents;
108 CHKERR m_field.get_moab().get_entities_by_handle(m, ents, true);
109 CHKERR m_field.get_moab().add_entities(p.first->getMeshset(), ents);
110 CHKERR m_field.get_moab().delete_entities(&m, 1);
111 }
112 }
113 }
114
115 std::vector<const CubitMeshSets *> vec_ptr;
116 for (auto &m : cubitMeshsets) {
117 vec_ptr.push_back(&m);
118 }
119 sortMeshsets(vec_ptr);
120
121 for (auto m_ptr : vec_ptr) {
122 MOFEM_LOG("MeshsetMngSync", Sev::verbose) << "read " << *m_ptr;
123 }
124 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::verbose);
125
127}

◆ setAttributes()

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

#include <src/interfaces/MeshsetsManager.hpp>

Set attributes for CUBIT meshset.

Assigns attribute values to a meshset. Attributes are typically used for material properties or other numerical parameters associated with the meshset entities.

Parameters
cubit_bc_typetype of meshset (BLOCKSET, NODESET, SIDESET, etc.)
ms_idCUBIT ID of the target meshset
attributesvector of attribute values to assign
nameoptional name to assign to the meshset
Returns
MoFEMErrorCode Error code indicating success or failure
Examples
mofem/atom_tests/add_cubit_meshsets.cpp.

Definition at line 470 of file MeshsetsManager.cpp.

472 {
473 Interface &m_field = cOre;
474 moab::Interface &moab = m_field.get_moab();
476 auto cit =
477 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
478 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
479 if (cit ==
480 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
481 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
482 "Cannot find Cubit meshset with id: %d", ms_id);
483 }
484 if (name.size() > 0) {
485 bool success = cubitMeshsets.modify(cubitMeshsets.project<0>(cit),
486 CubitMeshSets_change_name(moab, name));
487 if (!success) {
488 SETERRQ(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
489 "name to cubit meshset can not be set");
490 }
491 }
492 bool success =
493 cubitMeshsets.modify(cubitMeshsets.project<0>(cit),
494 CubitMeshSets_change_attributes(moab, attributes));
495 if (!success)
496 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
497 "modification unsuccessful");
498
499 std::ostringstream ss;
500 ss << "Block " << cit->getName();
501 ss << " Add attr: ";
502 for (unsigned int ii = 0; ii != attributes.size(); ii++) {
503 ss << attributes[ii] << " ";
504 }
505 MOFEM_LOG("MeshsetMngSelf", Sev::noisy) << ss.str();
506
508}

◆ setAttributesByDataStructure()

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

#include <src/interfaces/MeshsetsManager.hpp>

Set attributes using data structure.

Assigns material or other attributes to a meshset using a structured data object. This provides a more organized way to handle complex attribute data with proper typing and validation.

Parameters
cubit_bc_typetype of meshset (BLOCKSET, NODESET, SIDESET, etc.)
ms_idCUBIT ID of the target meshset
datastructured data containing attribute information
nameoptional name to assign to the meshset
Returns
MoFEMErrorCode Error code indicating success or failure

Definition at line 510 of file MeshsetsManager.cpp.

512 {
513 Interface &m_field = cOre;
514 moab::Interface &moab = m_field.get_moab();
516 auto cit =
517 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
518 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
519 if (cit ==
520 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
521 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
522 "Cannot find Cubit meshset with id: %d", ms_id);
523 }
524 if (name.size() > 0) {
525 bool success = cubitMeshsets.modify(cubitMeshsets.project<0>(cit),
526 CubitMeshSets_change_name(moab, name));
527 if (!success) {
528 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
529 "name to cubit meshset can not be set");
530 }
531 }
532 bool success = cubitMeshsets.modify(
533 cubitMeshsets.project<0>(cit),
534 CubitMeshSets_change_attributes_data_structure(moab, data));
535 if (!success)
536 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
537 "modification unsuccessful");
539}

◆ setBcData()

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

#include <src/interfaces/MeshsetsManager.hpp>

Set boundary condition data for meshset.

Assigns boundary condition data to a meshset. This includes constraint information, prescribed values, and application flags for various boundary condition types (displacement, force, pressure, etc.).

Parameters
cubit_bc_typetype of meshset (BLOCKSET, NODESET, SIDESET, etc.)
ms_idCUBIT ID of the target meshset
databoundary condition data structure
Returns
MoFEMErrorCode Error code indicating success or failure
Examples
mofem/atom_tests/add_cubit_meshsets.cpp.

Definition at line 541 of file MeshsetsManager.cpp.

543 {
544 Interface &m_field = cOre;
545 moab::Interface &moab = m_field.get_moab();
547 auto cit =
548 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().find(
549 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
550 if (cit ==
551 cubitMeshsets.get<Composite_Cubit_msId_And_MeshsetType_mi_tag>().end()) {
552 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
553 "Cubit meshset with id is already there id = %d", ms_id);
554 }
555 bool success =
556 cubitMeshsets.modify(cubitMeshsets.project<0>(cit),
557 CubitMeshSets_change_bc_data_structure(moab, data));
558 if (!success)
559 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
560 "modification unsuccessful");
562}

◆ setMeshsetFromFile()

MoFEMErrorCode MoFEM::MeshsetsManager::setMeshsetFromFile ( )

#include <src/interfaces/MeshsetsManager.hpp>

Load meshset configuration from command line specified file.

Reads the configuration file name from the command line option '-meshsets_config' and loads meshset definitions from that file. This provides a convenient way to specify meshset configurations at runtime without hardcoding file paths.

Command line usage: -meshsets_config filename.cfg

Returns
MoFEMErrorCode Error code indicating success or failure

Definition at line 1386 of file MeshsetsManager.cpp.

1386 {
1387 Interface &m_field = cOre;
1388 PetscBool flg_file;
1389 char meshset_file_name[255] = "config_file.cfg";
1391 PetscOptionsBegin(m_field.get_comm(), "", "Set meshsets form file",
1392 "none");
1393 CHKERR PetscOptionsString("-meshsets_config", "meshsets config file name",
1394 "", "add_cubit_meshsets.in", meshset_file_name, 255,
1395 &flg_file);
1396 if (flg_file == PETSC_TRUE) {
1397 ifstream f(meshset_file_name);
1398 if (!f.good()) {
1399 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
1400 "File configuring meshsets ( %s ) can not be open\n",
1401 meshset_file_name);
1402 }
1403 CHKERR setMeshsetFromFile(string(meshset_file_name));
1404 MOFEM_LOG("MeshsetMngWorld", Sev::inform)
1405 << "Printing all meshsets (old and added from meshsets "
1406 "configurational file)";
1407 for (auto cit = getBegin(); cit != getEnd(); cit++) {
1408 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *cit;
1409 }
1410 }
1411 PetscOptionsEnd();
1413}
CubitMeshSet_multiIndex::iterator getBegin() const
get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_TYPE_FOR_LOOP...
MoFEMErrorCode setMeshsetFromFile()
Load meshset configuration from command line specified file.
CubitMeshSet_multiIndex::iterator getEnd() const
get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_TYPE_FOR_LOOP...