v0.16.0
Loading...
Searching...
No Matches
MeshsetsManager.hpp
Go to the documentation of this file.
1/** \file MeshsetsManager.hpp
2 * \brief Interface for managing mesh sets containing materials and boundary conditions
3 * \ingroup mofem_meshset_mng
4 *
5 * The MeshsetsManager provides a comprehensive, format-agnostic interface for handling
6 * mesh sets within the MoFEM finite element framework. It serves as the foundational
7 * data management layer for boundary conditions and material properties, supporting
8 * multiple meshing software formats and integration patterns.
9 *
10 * Key functionality includes:
11 * - Generic meshset management compatible with CUBIT, Gmsh, Salome/MED, and other formats
12 * - MOAB-based efficient storage and parallel processing of meshset data
13 * - Integration with BcManager for high-level boundary condition application
14 * - Support for NODESET (vertex groups), SIDESET (surface groups), and BLOCKSET (volume groups)
15 * - Material property and boundary condition data association
16 * - Configuration file loading and parallel data synchronization
17 * - Multi-format tag translation and meshset discovery
18 *
19 * Format Support:
20 * - CUBIT/Coreform: Native support for nodesets, sidesets, and blocksets
21 * - Gmsh: Physical group translation to MoFEM meshsets
22 * - Salome/MED: Mesh group and CAD-based boundary definitions
23 * - Exodus II, ANSYS, Abaqus: Standard finite element format compatibility
24 * - Custom formats: Extensible tag-based approach for new meshing software
25 *
26 * The interface bridges the gap between mesh generation software conventions and
27 * MoFEM's finite element infrastructure, providing a unified approach to boundary
28 * condition and material management regardless of the original mesh source.
29 *
30 */
31
32#ifndef __MESHSETSMANAGER_HPP__
33#define __MESHSETSMANAGER_HPP__
34
35namespace MoFEM {
36
37typedef CubitMeshSet_multiIndex::index<CubitMeshsetType_mi_tag>::type
39
40typedef CubitMeshSet_multiIndex::index<CubitMeshsetMaskedType_mi_tag>::type
42
43typedef CubitMeshSet_multiIndex::index<CubitMeshsets_name>::type
45
46typedef CubitMeshSet_multiIndex::index<CubitMeshsetType_mi_tag>::type
48
49/**
50 * \brief Iterator that loops over all the Cubit MeshSets in a moFEM field
51 * \ingroup mofem_meshset_mng
52
53 *
54 * \param MESHSET_MANAGER meshset manager (works as well with Interface)
55 * \param iterator
56 */
57#define _IT_CUBITMESHSETS_FOR_LOOP_(MESHSET_MANAGER, IT) \
58 CubitMeshSet_multiIndex::iterator IT = \
59 MESHSET_MANAGER.get_meshsets_manager_ptr()->getBegin(); \
60 IT != MESHSET_MANAGER.get_meshsets_manager_ptr()->getEnd(); \
61 IT++
62
63/**
64* \brief Iterator that loops over a specific Cubit MeshSet in a moFEM field
65* \ingroup mofem_meshset_mng
66
67*
68* \param mField moFEM Field
69* \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
70* \param iterator
71*/
72#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, \
73 CUBITBCTYPE, IT) \
74 CubitMeshsetByType::iterator IT = \
75 MESHSET_MANAGER.get_meshsets_manager_ptr()->getBegin(CUBITBCTYPE); \
76 IT != MESHSET_MANAGER.get_meshsets_manager_ptr()->getEnd(CUBITBCTYPE); \
77 IT++
78
79/**
80* \brief Iterator that loops over a specific Cubit MeshSet having a particular
81BC meshset in a moFEM field
82* \ingroup mofem_meshset_mng
83
84*
85* \param MESHSET_MANAGER meshset manager (works as well with Interface)
86* \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
87* \param iterator
88*
89* Example: \code
90for(_IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it) {
91...
92* } \endcode
93*/
94#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, \
95 IT) \
96 CubitMeshsetByMask::iterator IT = \
97 MESHSET_MANAGER.get_meshsets_manager_ptr()->getBySetTypeBegin( \
98 CUBITBCTYPE); \
99 IT != MESHSET_MANAGER.get_meshsets_manager_ptr()->getBySetTypeEnd( \
100 CUBITBCTYPE); \
101 IT++
102
103/**
104* \brief Iterator that loops over Cubit BlockSet having a particular name
105* \ingroup mofem_meshset_mng
106
107
108* \param MESHSET_MANAGER meshset manager (works as well with Interface)
109* \param NAME name
110* \param IT iterator
111*
112* Example: \code
113for(_IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(mField,"SOME_BLOCK_NAME",it) {
114...
115* } \endcode
116*/
117#define _IT_CUBITMESHSETS_BY_NAME_FOR_LOOP_(MESHSET_MANAGER, NAME, IT) \
118 CubitMeshsetByName::iterator IT = \
119 MESHSET_MANAGER.get_meshsets_manager_ptr()->getBegin(NAME); \
120 IT != MESHSET_MANAGER.get_meshsets_manager_ptr()->getEnd(NAME); \
121 IT++
122
123/** \brief Interface for managing meshsets containing materials and boundary
124 * conditions
125 * \ingroup mofem_meshset_mng
126 *
127 * The MeshsetsManager provides comprehensive functionality for creating, managing,
128 * and querying mesh sets (materials, boundary conditions, and blocks) within the
129 * MoFEM framework. It serves as the foundation for higher-level boundary condition
130 * management and integrates seamlessly with various meshing software formats.
131 *
132 * \section mm_bc_connection Connection to BcManager
133 *
134 * The MeshsetsManager acts as the data layer for the BcManager interface:
135 * - **Data Storage**: MeshsetsManager stores meshset definitions, attributes, and entity associations
136 * - **BcManager Interface**: BcManager provides high-level boundary condition application using MeshsetsManager data
137 * - **Workflow Integration**: MeshsetsManager discovers and organizes meshsets, BcManager applies them to finite element problems
138 * - **Data Consistency**: Both interfaces ensure synchronized boundary condition data across parallel processes
139 *
140 * \section mm_moab_integration MOAB Meshset Integration
141 *
142 * MeshsetsManager leverages MOAB's native meshset capabilities:
143 * - **MOAB Meshsets**: Uses MOAB::EntitySet as the underlying container for mesh entities
144 * - **Tag System**: Utilizes MOAB tags for meshset identification and data storage
145 * - **Entity Management**: Manages collections of vertices, edges, faces, and volumes within meshsets
146 * - **Memory Efficiency**: Benefits from MOAB's optimized storage and query mechanisms
147 * - **Parallel Support**: Inherits MOAB's parallel meshset handling for distributed computations
148 *
149 * \section mm_cubit_concepts CUBIT/Coreform Meshset Types
150 *
151 * \subsection mm_nodeset NODESET
152 * - **Purpose**: Groups of vertices/nodes for applying nodal boundary conditions
153 * - **Usage**: Displacement constraints, temperature, concentrated forces, point sources
154 * - **CUBIT Creation**: Select vertices → Create Nodeset → Assign boundary conditions
155 * - **Examples**: Fixed supports, prescribed displacements, temperature constraints
156 *
157 * \subsection mm_sideset SIDESET
158 * - **Purpose**: Groups of faces/surfaces for applying surface boundary conditions
159 * - **Usage**: Pressure loads, heat flux, traction forces, interface conditions
160 * - **CUBIT Creation**: Select surfaces → Create Sideset → Assign surface conditions
161 * - **Examples**: Pressure on surfaces, heat transfer boundaries, contact interfaces
162 *
163 * \subsection mm_blockset BLOCKSET
164 * - **Purpose**: Groups of volumes/elements for material property assignment
165 * - **Usage**: Material definitions, element types, constitutive models
166 * - **CUBIT Creation**: Select volumes → Create Block → Assign material properties
167 * - **Examples**: Steel regions, concrete blocks, fluid domains, different element types
168 *
169 * \section mm_generic_approach Generic Multi-Format Support
170 *
171 * The MeshsetsManager approach is **not restricted to CUBIT** and supports multiple meshing formats:
172 *
173 * \subsection mm_gmsh Gmsh Integration
174 * - **Physical Groups**: Gmsh physical groups map to MoFEM meshsets
175 * - **Tag Translation**: Converts Gmsh physical tags to MOAB meshset tags
176 * - **Entity Types**: Supports Gmsh's point, line, surface, and volume physical groups
177 * - **Boundary Conditions**: Gmsh boundary markers become MoFEM boundary condition meshsets
178 *
179 * \subsection mm_salome Salome/MED Format Support
180 * - **MED Groups**: Salome mesh groups translate to MoFEM meshsets
181 * - **CAD Integration**: Preserves CAD-based boundary and material definitions
182 * - **Multi-Physics**: Supports Salome's multi-physics mesh organization
183 * - **CGNS Compatibility**: Handles complex boundary condition hierarchies
184 *
185 * \subsection mm_other_formats Other Format Support
186 * - **Exodus II**: Supports element blocks, node sets, and side sets
187 * - **ANSYS**: Converts component definitions to meshsets
188 * - **Abaqus**: Translates element sets and node sets
189 * - **Custom Formats**: Generic tag-based approach accommodates new formats
190 *
191 * \section mm_workflow Typical Multi-Format Workflow
192 *
193 * 1. **Mesh Import**: Load mesh with native format-specific group definitions
194 * 2. **Tag Discovery**: MeshsetsManager discovers and categorizes existing tags
195 * 3. **Meshset Creation**: Convert format-specific groups to unified meshset representation
196 * 4. **Data Association**: Attach material properties and boundary condition data
197 * 5. **Validation**: Verify meshset consistency and completeness
198 * 6. **Problem Setup**: Use meshsets for finite element problem definition
199 *
200 * \section mm_capabilities Key Capabilities
201 * - Creating and managing meshsets from various meshing software
202 * - Setting material properties and boundary condition data
203 * - Querying meshset contents and properties across different formats
204 * - Loading/saving meshset configurations with format preservation
205 * - Broadcasting meshset data across MPI processes
206 * - Generic tag-based approach for extensibility to new formats
207 */
209
210 /**
211 * \brief Query interface for MeshsetsManager
212 *
213 * @param type_index type index for the interface to query
214 * @param iface pointer to store the interface
215 * @return MoFEMErrorCode Error code indicating success or failure
216 */
217 MoFEMErrorCode query_interface(boost::typeindex::type_index type_index,
218 UnknownInterface **iface) const;
219
220 MoFEM::Core &cOre; ///< Reference to MoFEM Core interface
221
222 /**
223 * \brief Constructor for MeshsetsManager
224 *
225 * @param core reference to MoFEM Core interface for accessing mesh and field data
226 */
227 MeshsetsManager(const MoFEM::Core &core);
228 virtual ~MeshsetsManager() = default;
229
230 /**
231 * \brief Get tag handles used on meshsets
232 * \ingroup mofem_meshset_mng
233 *
234 * Retrieves MOAB tag handles for meshset identification and data storage.
235 * These tags follow CUBIT/MOAB conventions for nodesets, sidesets, and blocksets.
236 * The function initializes internal tag handles for subsequent meshset operations.
237 *
238 * @param verb verbosity level for output (-1 = default, higher values = more verbose)
239 * @return MoFEMErrorCode Error code indicating success or failure
240 */
241 MoFEMErrorCode getTags(int verb = -1);
242
243 /**
244 * \brief Static version of getTags for external MOAB interface
245 * \ingroup mofem_meshset_mng
246 *
247 * @param moab reference to MOAB interface
248 * @param nsTag reference to store nodeset tag handle
249 * @param ssTag reference to store sideset tag handle
250 * @param nsTag_data reference to store nodeset data tag handle
251 * @param ssTag_data reference to store sideset data tag handle
252 * @param bhTag reference to store blockset tag handle
253 * @param bhTag_header reference to store blockset header tag handle
254 * @param verb verbosity level for output
255 * @return MoFEMErrorCode Error code indicating success or failure
256 */
257 static MoFEMErrorCode getTags(moab::Interface &moab, Tag &nsTag, Tag &ssTag,
259 Tag &bhTag_header, int verb = -1);
260
261 /**
262 * \brief get tag handle used to store "id" of NODESET
263 */
264 inline Tag get_nsTag() const { return nsTag; }
265
266 /**
267 * \brief get tag handle used to store "id" of SIDESET
268 */
269 inline Tag get_ssTag() const { return ssTag; }
270
271 /**
272 * \brief get tag handle used to store boundary data on NODESET
273 */
274 inline Tag get_nsTag_data() const { return nsTag_data; }
275
276 /**
277 * \brief get tag handle used to store boundary data on SIDESET
278 */
279 inline Tag get_ssTag_data() const { return ssTag_data; }
280
281 /**
282 * \brief get tag handle used to store "id" of BLOCKSET
283 */
284 inline Tag get_bhTag() const { return bhTag; }
285
286 /**
287 * \brief get tag handle used to store of block set header (Used by Cubit)
288 */
289 inline Tag get_bhTag_header() const { return bhTag_header; }
290
291 /**
292 * \brief return pointer to meshset manager
293 */
295
296 /**
297 * \brief return pointer to meshset manager
298 */
299 const MeshsetsManager *get_meshsets_manager_ptr() const { return this; }
300
301 /**
302 * \brief Clear the multi-index container
303 * \ingroup mofem_meshset_mng
304 *
305 * Removes all stored meshset data from the internal container.
306 * Useful for reinitialization or memory cleanup.
307 *
308 * @return MoFEMErrorCode Error code indicating success or failure
309 */
311
312 /**
313 * \brief Remove imported BLOCKSET names and/or attributes from the mesh.
314 * \ingroup mofem_meshset_mng
315 *
316 * This is used by the JSON config path to control how much embedded block
317 * metadata is preserved from the mesh file before JSON data is applied.
318 *
319 * @param cleared_names optional pointer storing how many block names were removed
320 * @param cleared_attributes optional pointer storing how many block attribute tags were removed
321 * @param clear_names when true remove imported BLOCKSET names
322 * @param clear_attributes when true remove imported BLOCKSET attributes
323 * @return MoFEMErrorCode Error code indicating success or failure
324 */
326 std::size_t *cleared_names = nullptr,
327 std::size_t *cleared_attributes = nullptr,
328 const bool clear_names = true,
329 const bool clear_attributes = true);
330
331 /**
332 * \brief Initialize container from mesh data
333 * \ingroup mofem_meshset_mng
334 *
335 * Reads meshset information from the mesh database and populates the
336 * internal multi-index container. This includes discovering nodesets,
337 * sidesets, and blocksets with their associated tags and data.
338 *
339 * @param verb verbosity level for output
340 * @return MoFEMErrorCode Error code indicating success or failure
341 */
343
344 /**
345 * @brief Read meshsets from mesh database
346 * \ingroup mofem_meshset_mng
347 *
348 * Scans the mesh for existing meshsets and populates the manager's
349 * internal data structures. This is typically called after mesh loading
350 * to discover all available nodesets, sidesets, and blocksets.
351 *
352 * @param verb verbosity level for output
353 * @return MoFEMErrorCode Error code indicating success or failure
354 */
356
357 /**
358 * @brief Broadcast meshsets across MPI processes
359 * \ingroup mofem_meshset_mng
360 *
361 * Synchronizes meshset information across all MPI processes to ensure
362 * consistent meshset data in parallel computations. Typically called
363 * after meshset modifications on specific processes.
364 *
365 * @param verb verbosity level for output
366 * @return MoFEMErrorCode Error code indicating success or failure
367 */
369
370 template <class CUBIT_BC_DATA_TYPE>
371 MoFEMErrorCode printBcSet(CUBIT_BC_DATA_TYPE &data,
372 unsigned long int type) const;
373
374 /**
375 * \brief Print meshsets with displacement boundary conditions
376 * \ingroup mofem_meshset_mng
377 *
378 * Outputs information about all meshsets containing displacement boundary
379 * condition data, including constraint flags and prescribed values.
380 *
381 * @return MoFEMErrorCode Error code indicating success or failure
382 */
384
385 /**
386 * \brief Print meshsets with pressure boundary conditions
387 * \ingroup mofem_meshset_mng
388 *
389 * Outputs information about all meshsets containing pressure boundary
390 * condition data, including pressure magnitudes and application flags.
391 *
392 * @return MoFEMErrorCode Error code indicating success or failure
393 */
395
396 /**
397 * \brief Print meshsets with force boundary conditions
398 * \ingroup mofem_meshset_mng
399 *
400 * Outputs information about all meshsets containing force boundary
401 * condition data, including force and moment components.
402 *
403 * @return MoFEMErrorCode Error code indicating success or failure
404 */
406
407 /**
408 * \brief Print meshsets with temperature boundary conditions
409 * \ingroup mofem_meshset_mng
410 *
411 * Outputs information about all meshsets containing temperature boundary
412 * condition data, including prescribed temperature values.
413 *
414 * @return MoFEMErrorCode Error code indicating success or failure
415 */
417
418 /**
419 * \brief Print meshsets with heat flux boundary conditions
420 * \ingroup mofem_meshset_mng
421 *
422 * Outputs information about all meshsets containing heat flux boundary
423 * condition data, including flux magnitudes and directions.
424 *
425 * @return MoFEMErrorCode Error code indicating success or failure
426 */
428
429 /**
430 * \brief Print meshsets with material properties
431 * \ingroup mofem_meshset_mng
432 *
433 * Outputs information about all meshsets containing material data,
434 * including material parameters and constitutive model information.
435 *
436 * @return MoFEMErrorCode Error code indicating success or failure
437 */
439
443
444 /**
445 * \ingroup mofem_meshset_mng
446 * \brief get begin iterator of cubit meshset of given type (instead you can
447 * use _IT_CUBITMESHSETS_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
448 *
449 * for(_IT_CUBITMESHSETS_FOR_LOOP_(mField,it) {
450 * ...
451 * }
452 *
453 */
454 inline CubitMeshSet_multiIndex::iterator getBegin() const {
455 return cubitMeshsets.begin();
456 }
457
458 /**
459 * \ingroup mofem_meshset_mng
460 * \brief get begin iterator of cubit meshset of given type (instead you can
461 * use _IT_CUBITMESHSETS_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
462 *
463 * for(_IT_CUBITMESHSETS_FOR_LOOP_(mField,it) {
464 * ...
465 * }
466 *
467 */
468 CubitMeshSet_multiIndex::iterator getEnd() const {
469 return cubitMeshsets.end();
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 getBegin(const unsigned int cubit_bc_type) const {
488 return cubitMeshsets.get<CubitMeshsetType_mi_tag>().lower_bound(
489 cubit_bc_type);
490 }
491
492 /**
493 * \brief get begin 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 *
499 for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
500 {
501 * ...
502 * }
503 *
504 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
505 */
506 inline CubitMeshsetByType::iterator
507 getEnd(const unsigned int cubit_bc_type) const {
508 return cubitMeshsets.get<CubitMeshsetType_mi_tag>().upper_bound(
509 cubit_bc_type);
510 }
511
512 /**
513 * \brief get end iterator of cubit meshset of given type (instead you can
514 use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
515 * \ingroup mofem_meshset_mng
516
517 *
518 * for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET,it) {
519 * ...
520 * }
521 *
522 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
523 */
524 inline CubitMeshsetByMask::iterator
525 getBySetTypeBegin(const unsigned int cubit_bc_type) const {
526 return cubitMeshsets.get<CubitMeshsetMaskedType_mi_tag>().lower_bound(
527 cubit_bc_type);
528 }
529
530 /**
531 * \brief get end iterator of cubit meshset of given type (instead you can
532 use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
533 * \ingroup mofem_meshset_mng
534
535 *
536 * for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET,it) {
537 * ...
538 * }
539 *
540 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
541 */
542 inline CubitMeshsetByMask::iterator
543 getBySetTypeEnd(const unsigned int cubit_bc_type) const {
544 return cubitMeshsets.get<CubitMeshsetMaskedType_mi_tag>().upper_bound(
545 cubit_bc_type);
546 }
547
548 /**
549 * \brief get begin iterator of cubit meshset of given type (instead you can
550 use _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
551 * \ingroup mofem_meshset_mng
552
553 *
554 *
555 for(_IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
556 {
557 * ...
558 * }
559 *
560 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
561 */
562 inline CubitMeshsetByName::iterator getBegin(const std::string &name) const {
563 return cubitMeshsets.get<CubitMeshsets_name>().lower_bound(name);
564 }
565
566 /**
567 * \brief get begin iterator of cubit meshset of given type (instead you can
568 use _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
569 * \ingroup mofem_meshset_mng
570
571 *
572 *
573 for(_IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
574 {
575 * ...
576 * }
577 *
578 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
579 */
580 inline CubitMeshsetByName::iterator getEnd(const std::string &name) const {
581 return cubitMeshsets.get<CubitMeshsets_name>().upper_bound(name);
582 }
583
584 /**
585 * \brief Check for CUBIT meshset by ID and type
586 * \ingroup mofem_meshset_mng
587 *
588 * Verifies if a meshset with the specified CUBIT ID and type exists
589 * in the manager's database. Useful for validation before accessing
590 * meshset properties or entities.
591 *
592 * \todo All cubit interface functions should be outsourced to dedicated
593 * interface
594 *
595 * @param ms_id CUBIT ID of the meshset (BLOCKSET/SIDESET/NODESET)
596 * @param cubit_bc_type type of meshset (NODESET, SIDESET, BLOCKSET, etc.)
597 * @return bool true if meshset exists, false otherwise
598 */
599 bool checkMeshset(const int ms_id, const CubitBCType cubit_bc_type) const;
600
601 /**
602 * \brief Check if meshset with given name exists
603 * \ingroup mofem_meshset_mng
604 *
605 * Searches for meshsets by name and optionally returns the count of
606 * matching meshsets. Multiple meshsets can have the same name.
607 *
608 * @param name name of the meshset to search for
609 * @param number_of_meshsets_ptr optional pointer to store count of matching meshsets
610 * @return bool true if at least one meshset with the name exists, false otherwise
611 */
612 bool checkMeshset(const string name,
613 int *const number_of_meshsets_ptr = NULL) const;
614
615 /**
616 * \brief Add CUBIT meshset to manager
617 * \ingroup mofem_meshset_mng
618 *
619 * Creates a new meshset entry in the manager's database with the specified
620 * CUBIT type and ID. The meshset can be given an optional name for easier
621 * identification and access.
622 *
623 * @param cubit_bc_type type of meshset (NODESET, SIDESET, BLOCKSET, etc.)
624 * @param ms_id CUBIT ID for the meshset
625 * @param name optional name for the meshset (empty string if not specified)
626 * @return MoFEMErrorCode Error code indicating success or failure
627 */
628 MoFEMErrorCode addMeshset(const CubitBCType cubit_bc_type, const int ms_id,
629 const std::string name = "");
630
631 /// Adds an extra classification bit to an existing meshset type.
632 /// Example: promote a plain BLOCKSET to BLOCKSET|MAT_THERMALSET.
634 const int ms_id,
635 const CubitBCType type_bit);
636
637 /**
638 * \brief Add entities to CUBIT meshset
639 * \ingroup mofem_meshset_mng
640 *
641 * Adds a range of mesh entities to an existing meshset. The entities
642 * become part of the meshset for subsequent operations like applying
643 * boundary conditions or material properties.
644 *
645 * @param cubit_bc_type type of meshset (NODESET, SIDESET, BLOCKSET, etc.)
646 * @param ms_id CUBIT ID of the target meshset
647 * @param ents range of entities to add to the meshset
648 * @return MoFEMErrorCode Error code indicating success or failure
649 */
651 const int ms_id, const Range &ents);
652
653 /**
654 * \brief Add entities to CUBIT meshset (array version)
655 * \ingroup mofem_meshset_mng
656 *
657 * Adds an array of mesh entities to an existing meshset. This version
658 * accepts entities as a C-style array with explicit count.
659 *
660 * @param cubit_bc_type type of meshset (NODESET, SIDESET, BLOCKSET, etc.)
661 * @param ms_id CUBIT ID of the target meshset
662 * @param ents pointer to array of entity handles
663 * @param nb_ents number of entities in the array
664 * @return MoFEMErrorCode Error code indicating success or failure
665 */
667 const int ms_id, const EntityHandle *ents,
668 const int nb_ents);
669
670 /**
671 * \brief Set attributes for CUBIT meshset
672 * \ingroup mofem_meshset_mng
673 *
674 * Assigns attribute values to a meshset. Attributes are typically used
675 * for material properties or other numerical parameters associated with
676 * the meshset entities.
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 attributes vector of attribute values to assign
681 * @param name optional name to assign to the meshset
682 * @return MoFEMErrorCode Error code indicating success or failure
683 */
684 MoFEMErrorCode setAttributes(const CubitBCType cubit_bc_type, const int ms_id,
685 const std::vector<double> &attributes,
686 const std::string name = "");
687
688 MoFEMErrorCode setName(const CubitBCType cubit_bc_type, const int ms_id,
689 const std::string &name);
690
691 DEPRECATED inline auto setAtributes(const CubitBCType cubit_bc_type,
692 const int ms_id,
693 const std::vector<double> &attributes,
694 const std::string name = "") {
695 return setAttributes(cubit_bc_type, ms_id,
696 std::vector<double>(attributes), name);
697 }
698
699 /**
700 * \brief Set attributes using data structure
701 * \ingroup mofem_meshset_mng
702 *
703 * Assigns material or other attributes to a meshset using a structured
704 * data object. This provides a more organized way to handle complex
705 * attribute data with proper typing and validation.
706 *
707 * @param cubit_bc_type type of meshset (BLOCKSET, NODESET, SIDESET, etc.)
708 * @param ms_id CUBIT ID of the target meshset
709 * @param data structured data containing attribute information
710 * @param name optional name to assign to the meshset
711 * @return MoFEMErrorCode Error code indicating success or failure
712 */
714 const int ms_id,
715 const GenericAttributeData &data,
716 const std::string name = "");
717
719 const CubitBCType cubit_bc_type, const int ms_id,
720 const GenericAttributeData &data, const std::string name = "") {
721 return setAttributesByDataStructure(cubit_bc_type, ms_id, data, name);
722 }
723
724
725 /**
726 * \brief Set boundary condition data for meshset
727 * \ingroup mofem_meshset_mng
728 *
729 * Assigns boundary condition data to a meshset. This includes constraint
730 * information, prescribed values, and application flags for various
731 * boundary condition types (displacement, force, pressure, etc.).
732 *
733 * @param cubit_bc_type type of meshset (BLOCKSET, NODESET, SIDESET, etc.)
734 * @param ms_id CUBIT ID of the target meshset
735 * @param data boundary condition data structure
736 * @return MoFEMErrorCode Error code indicating success or failure
737 */
738 MoFEMErrorCode setBcData(const CubitBCType cubit_bc_type, const int ms_id,
739 const GenericCubitBcData &data);
740
741 /**
742 * \brief delete cubit meshset
743 * \ingroup mofem_bc
744
745 *
746 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
747 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
748 *
749 */
750 MoFEMErrorCode deleteMeshset(const CubitBCType cubit_bc_type, const int ms_id,
751 const MoFEMTypes bh = MF_EXIST);
752
753 /**
754 * \brief get cubit meshset
755 * \ingroup mofem_meshset_mng
756 *
757 *
758 */
760 getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type,
761 const CubitMeshSets **cubit_meshset_ptr) const;
762
763 /**
764 * \brief get cubit meshset
765 * \ingroup mofem_meshset_mng
766 *
767 *
768 */
769 const CubitMeshSets *
770 getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type) const;
771
772 /**
773 * @brief Get vector of pointer by bc type
774 *
775 * \ingroup mofem_meshset_mng
776 *
777 * @param std::vector<const CubitMeshSets *>
778 * @return MoFEMErrorCode
779 */
781 getCubitMeshsetPtr(const CubitBCType cubit_bc_type,
782 std::vector<const CubitMeshSets *> &vec_ptr) const;
783
784/**
785 * @brief Get vector of pointer by bc type
786 *
787 * \ingroup mofem_meshset_mng
788 *
789 * @return MoFEMErrorCode
790 */
791 std::vector<const CubitMeshSets *>
792 getCubitMeshsetPtr(const CubitBCType cubit_bc_type) const;
793
794 /**
795 * \brief get cubit meshset
796 *
797 * \ingroup mofem_meshset_mng
798 */
800 getCubitMeshsetPtr(const string name,
801 const CubitMeshSets **cubit_meshset_ptr) const;
802
803 /**
804 * @brief Get vector of pointer to blocksets with name satisfying regular
805 * expression.
806 *
807 * \ingroup mofem_meshset_mng
808 *
809 * @param reg_exp_name
810 * @param std::vector<const CubitMeshSets *>
811 * @return MoFEMErrorCode
812 */
814 getCubitMeshsetPtr(const std::regex reg_exp_name,
815 std::vector<const CubitMeshSets *> &vec_ptr) const;
816
817 /**
818 * @brief Get vector of pointer to blocksets with name satisfying regular
819 * expression.
820 *
821 * \ingroup mofem_meshset_mng
822 *
823 * \code
824 for (auto m :
825 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
826
827 (boost::format("%s(.*)") % block_name).str()
828
829 ))
830
831 ) {
832 MOFEM_LOG("WORLD", Sev::inform) << m->getName();
833
834 Range ents;
835 m_field.get_moab().get_entities_by_dimension(
836 m->getMeshset(), 0, ents, false);
837
838 auto print_ents = [](boost::shared_ptr<FieldEntity> ent_ptr) {
839 MoFEMFunctionBegin;
840 if(!(ent_ptr->getPStatus() & PSTATUS_NOT_OWNED)) {
841 MOFEM_LOG("SYNC", Sev::inform) << ent_ptr->getName() << ": " <<
842 ent_ptr->getEntFieldData();
843 }
844 MoFEMFunctionReturn(0);
845 };
846
847 CHKERR m_field.getInterface<FieldBlas>()->fieldLambdaOnEntities(
848 print_ents, "VELOCITIES", &ents);
849 CHKERR m_field.getInterface<FieldBlas>()->fieldLambdaOnEntities(
850 print_ents, "DISPLACEMENTS", &ents);
851 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::ifrom);
852 }
853 * \endcode
854 *
855 * @param reg_exp_name
856 * @return std::vector<const CubitMeshSets *>
857 */
858 std::vector<const CubitMeshSets *>
859 getCubitMeshsetPtr(const std::regex reg_exp_name) const;
860
861 /**
862 * \brief get entities from CUBIT/meshset of a particular entity dimension
863 * \ingroup mofem_meshset_mng
864
865 * Nodeset can contain nodes, edges, triangles and tets. This applies to
866 other meshsets too.
867 * The nodeset's meshset contain the nodes in the MIDDLE of the surface or
868 volume which is done by default in Cubit,
869 * Hence if all nodes on a particular nodeset are required,
870 * one should get all triangles or tetrahedrons for which the nodeset was
871 create in Cubit,
872 * and get all the connectivities of tris/tets.
873
874 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
875 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
876 * \param dimensions (0 - Nodes, 1 - Edges, 2 - Faces, 3 -
877 Volume(tetrahedral))
878 * \param Range containing the retrieved entities
879 * \param recursive If true, meshsets containing meshsets are queried
880 recursively. Returns the contents of meshsets, but not the meshsets
881 themselves if true.
882 */
884 const unsigned int cubit_bc_type,
885 const int dimension, Range &entities,
886 const bool recursive = true) const;
887
888 /**
889 * \brief get entities related to CUBIT/meshset,
890 * \ingroup mofem_meshset_mng
891
892 * NODESET will get Vertices only, even if the NODESET contains edges, tris
893 and tets
894 * SIDESET will get Tris, BLOCKSET will get Tets, DISPLACEMENTSET and
895 FORCESET are stored in NODESET, PRESSURESET is stored in Sideset.
896
897 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
898 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
899 * \param Range containing the retrieved entities related to the
900 * \param recursive If true, meshsets containing meshsets are queried
901 recursively. Returns the contents of meshsets, but not the meshsets
902 themselves if true.
903 */
905 const unsigned int cubit_bc_type,
906 Range &entities,
907 const bool recursive = true) const;
908
909 /**
910 * \ingroup mofem_meshset_mng
911 * \brief get meshset from CUBIT Id and CUBIT type
912 *
913 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
914 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
915 * \param meshset where to store the retrieved entities
916 */
917 MoFEMErrorCode getMeshset(const int ms_id, const unsigned int cubit_bc_type,
918 EntityHandle &meshset) const;
919
920 /**
921 * @brief Check if meshset constains entities
922 *
923 * @param ms_id
924 * @param cubit_bc_type
925 * @param entities
926 * @param num_entities
927 * @param operation_type
928 * @return true
929 * @return false
930 */
932 const int ms_id, const unsigned int cubit_bc_type,
933 const EntityHandle *entities, int num_entities,
934 const int operation_type = moab::Interface::INTERSECT);
935
936 /**
937 * \ingroup mofem_meshset_mng
938 * \brief get all CUBIT meshsets by CUBIT type
939 *
940 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more).
941 * \param meshsets is range of meshsets
942 */
943 MoFEMErrorCode getMeshsetsByType(const unsigned int cubit_bc_type,
944 Range &meshsets) const;
945
946 /**
947 * \brief add blocksets reading config file
948
949 Example of config file
950 \code
951
952 [block_1001]
953
954 # Example applying attributes to blockset
955
956 id=2001
957 add=BLOCKSET
958 user1=1.0 # attribute value 1
959 user2=2.0 # legacy form supports user1 up to user10
960 user3=3.0
961 # alternatively, for any number of attributes:
962 # user_array=1.0, 2.0, 3.0, 4.0
963
964 [block_1002]
965
966 # Example applying material block (isotropic elastic material)
967
968 id=2002
969 add=BLOCKSET
970 name=MAT_ELASTIC
971 young=10
972 poisson=0.25
973 thermalexpansion=0
974
975 [block_1003]
976
977 # Example applying displacement constrains
978
979 id=2003
980 add=NODESET
981
982 # Each flag means that boundary consition on displacements is set.
983 disp_flag1=1 # Setting constrains in x- direction
984 disp_flag2=1 # Setting constrains in y- direction
985 disp_flag3=1 # Setting constrains in z- direction
986 disp_flag4=1 # Setting constrains on rotation over x- axis
987 disp_flag5=1 # Setting constrains on rotation over y- axis
988 disp_flag6=1 # Setting constrains on rotation over z-axis
989 disp_ux=1 # value of disp in x- direction
990 disp_uy=2
991 disp_uz=3
992 disp_rx=4 # value of rotation in y-direction
993 disp_ry=5
994 disp_rz=6
995
996 # Note above values could be interpreted differently if needed.
997
998 [block_1004]
999
1000 # Example applying force boundary conditions
1001
1002 id=2004
1003 add=NODESET
1004 force_magnitude=1
1005 moment_magnitude=1
1006 force_fx=1
1007 force_fy=1
1008 force_fz=1
1009 moment_mx=1
1010 moment_my=1
1011 moment_mz=1
1012
1013 [block_1005]
1014
1015 # Example applying pressure boundary conditions
1016
1017 id=2005
1018 add=SIDESET
1019 pressure_flag2=1 # 0: Pressure is interpreted as pure pressure 1:
1020 pressure is interpreted as total force
1021 pressure_magnitude=1
1022
1023 # Example applying temperature boundary conditions
1024
1025 [block_1006]
1026
1027 id=2006
1028 add=NODESET
1029 temperature_flag1=1 # 0: N/A, 1: temperature value applied
1030 temperature_t=1
1031
1032 [block_1007]
1033
1034 id=2007
1035 add=SIDESET
1036 heatflux_flag1=1 # 0: N/A, 1: heat flux applied
1037 heatflux_magnitude=1
1038
1039 [block_1008]
1040
1041 # Example applying material block (isotropic thermal material)
1042
1043 id=2008
1044 add=BLOCKSET
1045 name=MAT_THERMAL # Hast to be set for Thermal Mat
1046 conductivity=1
1047 capacity=1
1048
1049 [block_1009]
1050
1051 # Example applying interface
1052 id=2009
1053 add=SIDESET
1054 interface_type=1
1055
1056 [block_1010]
1057
1058 # Example applying material block for interface element
1059
1060 id=2010
1061 add=BLOCKSET
1062 name=MAT_INTERF
1063 interface_alpha = 1
1064 interface_beta = 0
1065 interface_ft = 1
1066 interface_Gf = 1
1067
1068
1069 [block_1009]
1070
1071 # Example applying material block (isotropic trans iso material)
1072
1073 id=2011
1074 add=BLOCKSET
1075 name=MAT_ELASTIC_TRANS_ISO
1076 Youngp=1
1077 Youngz=2
1078 Poissonp=3
1079 Poissonpz=4
1080 Shearzp=5
1081
1082 [SET_ATTR_FOO]
1083
1084 # Example set atttributes to block name "FOO"
1085 number_of_attributes=3
1086 user1=1
1087 user2=2
1088 user3=3
1089 # alternatively, number_of_attributes is inferred from:
1090 # user_array=1, 2, 3
1091
1092 \endcode
1093
1094 * @param file_name path to configuration file containing meshset definitions
1095 * @param clean_file_options whether to clean existing file options before loading
1096 * @return MoFEMErrorCode Error code indicating success or failure
1097 */
1098 MoFEMErrorCode setMeshsetFromFile(const string file_name,
1099 const bool clean_file_options = true);
1100
1101 /**
1102 * \brief Load meshset configuration from command line specified file
1103 * \ingroup mofem_meshset_mng
1104 *
1105 * Reads the configuration file name from the command line option
1106 * '-meshsets_config' and loads meshset definitions from that file.
1107 * This provides a convenient way to specify meshset configurations
1108 * at runtime without hardcoding file paths.
1109 *
1110 * Command line usage: -meshsets_config filename.cfg
1111 *
1112 * @return MoFEMErrorCode Error code indicating success or failure
1113 */
1115
1116 /**
1117 * @brief save cubit meshset entities on the moab mesh
1118 *
1119 * @param ms_id id of the cubit meshset (NODESET SIDESET BLOCKSET)
1120 * @param cubit_bc_type type of a cubit mesheset
1121 * @param file_name optional name for the file
1122 * @param file_type optional file type for moab (VTK MOAB)
1123 * @param options optional parameters for moab writer (PARALLEL=WRITE_PART)
1124 * @return MoFEMErrorCode
1125 */
1127 saveMeshsetToFile(const int ms_id, const unsigned int cubit_bc_type,
1128 const std::string file_name = "out_meshset.vtk",
1129 const std::string file_type = "VTK",
1130 const std::string options = "") const;
1131
1132 /**
1133 * @brief save cubit meshset entities on the moab mesh
1134 *
1135 * @param ms_id id of the cubit meshset
1136 * @param cubit_bc_type type of a cubit mesheset (NODESET SIDESET BLOCKSET)
1137 * @param dim dimension of the entities
1138 * @param file_name optional name for the file
1139 * @param file_type optional file type for moab (VTK MOAB)
1140 * @param options optional parameters for moab writer (PARALLEL=WRITE_PART)
1141 * @return MoFEMErrorCode
1142 */
1144 const int ms_id, const unsigned int cubit_bc_type, const int dim,
1145 const std::string file_name = "out_meshset.vtk",
1146 const bool recursive = false, const std::string file_type = "VTK",
1147 const std::string options = "") const;
1148
1149 /**
1150 * \brief Get config file options, use with care
1151 * @return error code
1152 */
1153 inline boost::shared_ptr<boost::program_options::options_description> &
1157
1158 /**
1159 * @brief Update all blocksets, sidesets and node sets
1160 *
1161 * @param bit
1162 * @return MoFEMErrorCode
1163 */
1165
1166 static bool broadcastMeshsetsOn; ///< if true meshsets are synchronised
1167 ///< between processors
1168
1169 static void sortMeshsets(std::vector<const CubitMeshSets *> &vec_ptr);
1170
1171protected:
1178
1179 // cubit
1181 boost::shared_ptr<boost::program_options::options_description>
1182 configFileOptionsPtr; ///< config file options
1183
1184};
1185
1186template <class CUBIT_BC_DATA_TYPE>
1188 unsigned long int type) const {
1190 const MoFEM::Interface &m_field = cOre;
1191 const moab::Interface &moab = m_field.get_moab();
1192 for (auto it : getCubitMeshsetPtr(type)) {
1193 CHKERR it->getBcDataStructure(data);
1194 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *it;
1195 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << data;
1196 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << "name " << it->getName();
1197 for (EntityType t = MBVERTEX; t != MBENTITYSET; ++t) {
1198 int nb;
1199 CHKERR moab.get_number_entities_by_type(it->meshset, t, nb, true);
1200 if (nb > 0) {
1201 MOFEM_LOG("MeshsetMngSync", Sev::inform)
1202 << "msId " << it->getMeshsetId() << " number of "
1203 << moab::CN::EntityTypeName(t) << " " << nb;
1204 }
1205 }
1206 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::inform);
1207 }
1209}
1210
1211} // namespace MoFEM
1212
1213#endif //__MESHSETSMANAGER_HPP__
1214
1215/**
1216 * \defgroup mofem_meshset_mng MeshsetsManager
1217 * \brief Interface for meshsets with entities with data and boundary conditions
1218 *
1219 * \ingroup mofem
1220 **/
std::string type
#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.
MoFEMErrorCode deleteMeshset(const CubitBCType cubit_bc_type, const int ms_id, const MoFEMTypes bh=MF_EXIST)
delete cubit meshset
#define MOFEM_LOG(channel, severity)
Log.
MoFEMErrorCode printForceSet() const
Print meshsets with force boundary conditions.
CubitMeshsetByType::iterator getEnd(const unsigned int cubit_bc_type) const
get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYP...
CubitMeshsetByName::iterator getEnd(const std::string &name) const
get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_SET_TYPE_F...
MoFEMErrorCode getMeshset(const int ms_id, const unsigned int cubit_bc_type, EntityHandle &meshset) const
get meshset from CUBIT Id and CUBIT type
MoFEMErrorCode setBcData(const CubitBCType cubit_bc_type, const int ms_id, const GenericCubitBcData &data)
Set boundary condition data for meshset.
MoFEMErrorCode broadcastMeshsets(int verb=DEFAULT_VERBOSITY)
Broadcast meshsets across MPI processes.
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=DEFAULT_VERBOSITY)
Initialize container from mesh data.
MoFEMErrorCode clearMap()
Clear the multi-index container.
MoFEMErrorCode setAttributes(const CubitBCType cubit_bc_type, const int ms_id, const std::vector< double > &attributes, const std::string name="")
Set attributes for CUBIT meshset.
MoFEMErrorCode addEntitiesToMeshset(const CubitBCType cubit_bc_type, const int ms_id, const Range &ents)
Add entities to CUBIT meshset.
bool checkMeshset(const int ms_id, const CubitBCType cubit_bc_type) const
Check for CUBIT meshset by ID and type.
MoFEMErrorCode discardBlocksetConfiguration(std::size_t *cleared_names=nullptr, std::size_t *cleared_attributes=nullptr, const bool clear_names=true, const bool clear_attributes=true)
Remove imported BLOCKSET names and/or attributes from the mesh.
CubitMeshSet_multiIndex::iterator getBegin() const
get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_TYPE_FOR_LOOP...
MoFEMErrorCode printPressureSet() const
Print meshsets with pressure boundary conditions.
MoFEMErrorCode printMaterialsSet() const
Print meshsets with material properties.
CubitMeshsetByMask::iterator getBySetTypeEnd(const unsigned int cubit_bc_type) const
get end iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_...
MoFEMErrorCode setMeshsetFromFile()
Load meshset configuration from command line specified file.
MoFEMErrorCode addMeshset(const CubitBCType cubit_bc_type, const int ms_id, const std::string name="")
Add CUBIT meshset to manager.
CubitMeshsetByName::iterator getBegin(const std::string &name) const
get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_SET_TYPE_F...
MoFEMErrorCode getMeshsetsByType(const unsigned int cubit_bc_type, Range &meshsets) const
get all CUBIT meshsets by CUBIT type
MoFEMErrorCode getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr) const
get cubit meshset
CubitMeshsetByType::iterator getBegin(const unsigned int cubit_bc_type) const
get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYP...
MoFEMErrorCode getEntitiesByDimension(const int ms_id, const unsigned int cubit_bc_type, const int dimension, Range &entities, const bool recursive=true) const
get entities from CUBIT/meshset of a particular entity dimension
MoFEMErrorCode readMeshsets(int verb=DEFAULT_VERBOSITY)
Read meshsets from mesh database.
MoFEMErrorCode printHeatFluxSet() const
Print meshsets with heat flux boundary conditions.
MoFEMErrorCode printTemperatureSet() const
Print meshsets with temperature boundary conditions.
MoFEMErrorCode getTags(int verb=-1)
Get tag handles used on meshsets.
MoFEMErrorCode setAttributesByDataStructure(const CubitBCType cubit_bc_type, const int ms_id, const GenericAttributeData &data, const std::string name="")
Set attributes using data structure.
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_...
MoFEMErrorCode printDisplacementSet() const
Print meshsets with displacement boundary conditions.
CubitMeshSet_multiIndex::iterator getEnd() const
get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_TYPE_FOR_LOOP...
auto bit
set bit
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< 32 > CubitBCType
Definition Types.hpp:52
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition Types.hpp:40
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
CubitMeshSet_multiIndex::index< CubitMeshsetType_mi_tag >::type CubitMeshsetById
CubitMeshSet_multiIndex::index< CubitMeshsetMaskedType_mi_tag >::type CubitMeshsetByMask
CubitMeshSet_multiIndex::index< CubitMeshsets_name >::type CubitMeshsetByName
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,...
CubitMeshSet_multiIndex::index< CubitMeshsetType_mi_tag >::type CubitMeshsetByType
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:83
this struct keeps basic methods for moab meshset about material and boundary conditions
MultiIndex Tag for field id.
Deprecated interface functions.
Generic attribute data structure.
Generic bc data structure.
Definition BCData.hpp:16
Interface for managing meshsets containing materials and boundary conditions.
MoFEMErrorCode addBitToMeshsetType(const CubitBCType cubit_bc_type, const int ms_id, const CubitBCType type_bit)
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
const MeshsetsManager * get_meshsets_manager_ptr() const
return pointer to meshset manager
Tag get_bhTag() const
get tag handle used to store "id" of BLOCKSET
DEPRECATED auto setAtributesByDataStructure(const CubitBCType cubit_bc_type, const int ms_id, const GenericAttributeData &data, const std::string name="")
MeshsetsManager * get_meshsets_manager_ptr()
return pointer to meshset manager
DEPRECATED auto setAtributes(const CubitBCType cubit_bc_type, const int ms_id, const std::vector< double > &attributes, const std::string name="")
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.
static void sortMeshsets(std::vector< const CubitMeshSets * > &vec_ptr)
MoFEMErrorCode setName(const CubitBCType cubit_bc_type, const int ms_id, const std::string &name)
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Query interface for MeshsetsManager.
MoFEMErrorCode updateAllMeshsetsByEntitiesChildren(const BitRefLevel &bit)
Update all blocksets, sidesets and node sets.
boost::shared_ptr< boost::program_options::options_description > & getConfigFileOptionsPtr()
Get config file options, use with care.
MoFEMErrorCode printBcSet(CUBIT_BC_DATA_TYPE &data, unsigned long int type) const
CubitMeshSet_multiIndex & getMeshsetsMultindex()
Tag get_bhTag_header() const
get tag handle used to store of block set header (Used by Cubit)
Tag get_nsTag() const
get tag handle used to store "id" of NODESET
Tag get_nsTag_data() const
get tag handle used to store boundary data on NODESET
CubitMeshSet_multiIndex cubitMeshsets
cubit meshsets
virtual ~MeshsetsManager()=default
Tag get_ssTag_data() const
get tag handle used to store boundary data on SIDESET
Tag get_ssTag() const
get tag handle used to store "id" of SIDESET
MoFEM::Core & cOre
Reference to MoFEM Core interface.
boost::shared_ptr< boost::program_options::options_description > configFileOptionsPtr
config file options
base class for all interface classes