v0.13.1
Loading...
Searching...
No Matches
MeshsetsManager.hpp
Go to the documentation of this file.
1/** \file MeshsetsManager.hpp
2 * \brief MeshsetsManager interface
3
4 Interface to manage material and boundary sets
5
6 * \ingroup mofem_meshset_mng
7 */
8
9#ifndef __MESHSETSMANAGER_HPP__
10#define __MESHSETSMANAGER_HPP__
11
12namespace MoFEM {
13
14typedef CubitMeshSet_multiIndex::index<CubitMeshsetType_mi_tag>::type
16
17typedef CubitMeshSet_multiIndex::index<CubitMeshsetMaskedType_mi_tag>::type
19
20typedef CubitMeshSet_multiIndex::index<CubitMeshsets_name>::type
22
23typedef CubitMeshSet_multiIndex::index<CubitMeshsetType_mi_tag>::type
25
26/**
27 * \brief Iterator that loops over all the Cubit MeshSets in a moFEM field
28 * \ingroup mofem_meshset_mng
29
30 *
31 * \param MESHSET_MANAGER meshset manager (works as well with Interface)
32 * \param iterator
33 */
34#define _IT_CUBITMESHSETS_FOR_LOOP_(MESHSET_MANAGER, IT) \
35 CubitMeshSet_multiIndex::iterator IT = \
36 MESHSET_MANAGER.get_meshsets_manager_ptr()->getBegin(); \
37 IT != MESHSET_MANAGER.get_meshsets_manager_ptr()->getEnd(); \
38 IT++
39
40/**
41* \brief Iterator that loops over a specific Cubit MeshSet in a moFEM field
42* \ingroup mofem_meshset_mng
43
44*
45* \param mField moFEM Field
46* \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
47* \param iterator
48*/
49#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, \
50 CUBITBCTYPE, IT) \
51 CubitMeshsetByType::iterator IT = \
52 MESHSET_MANAGER.get_meshsets_manager_ptr()->getBegin(CUBITBCTYPE); \
53 IT != MESHSET_MANAGER.get_meshsets_manager_ptr()->getEnd(CUBITBCTYPE); \
54 IT++
55
56/**
57* \brief Iterator that loops over a specific Cubit MeshSet having a particular
58BC meshset in a moFEM field
59* \ingroup mofem_meshset_mng
60
61*
62* \param MESHSET_MANAGER meshset manager (works as well with Interface)
63* \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
64* \param iterator
65*
66* Example: \code
67for(_IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it) {
68...
69* } \endcode
70*/
71#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, \
72 IT) \
73 CubitMeshsetByMask::iterator IT = \
74 MESHSET_MANAGER.get_meshsets_manager_ptr()->getBySetTypeBegin( \
75 CUBITBCTYPE); \
76 IT != MESHSET_MANAGER.get_meshsets_manager_ptr()->getBySetTypeEnd( \
77 CUBITBCTYPE); \
78 IT++
79
80/**
81* \brief Iterator that loops over Cubit BlockSet having a particular name
82* \ingroup mofem_meshset_mng
83
84
85* \param MESHSET_MANAGER meshset manager (works as well with Interface)
86* \param NAME name
87* \param IT iterator
88*
89* Example: \code
90for(_IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(mField,"SOME_BLOCK_NAME",it) {
91...
92* } \endcode
93*/
94#define _IT_CUBITMESHSETS_BY_NAME_FOR_LOOP_(MESHSET_MANAGER, NAME, IT) \
95 CubitMeshsetByName::iterator IT = \
96 MESHSET_MANAGER.get_meshsets_manager_ptr()->getBegin(NAME); \
97 IT != MESHSET_MANAGER.get_meshsets_manager_ptr()->getEnd(NAME); \
98 IT++
99
100/** \brief Interface for managing meshsets containing materials and boundary
101 * conditions
102 * \ingroup mofem_meshset_mng
103 */
105
106 MoFEMErrorCode query_interface(boost::typeindex::type_index type_index,
107 UnknownInterface **iface) const;
108
110 MeshsetsManager(const MoFEM::Core &core);
111 virtual ~MeshsetsManager() = default;
112
113 /**
114 * \brief get tags handlers used on meshsets
115
116 * On meshsets range of tags in set. Depending on tag type and data on that
117 * tag type of meshset could be determined. This function get hanldes to
118 * tags.
119 *
120 * Most of the tags are followinf convention used by MoAB or Cubit and other
121 * meshing softwares, f.e. gmesh.
122
123 */
124 MoFEMErrorCode getTags(int verb = -1);
125
126 /**
127 * \brief get tag handle used to store "id" of NODESET
128 */
129 inline Tag get_nsTag() const { return nsTag; }
130
131 /**
132 * \brief get tag handle used to store "id" of SIDESET
133 */
134 inline Tag get_ssTag() const { return ssTag; }
135
136 /**
137 * \brief get tag handle used to store boundary data on NODESET
138 */
139 inline Tag get_nsTag_data() const { return nsTag_data; }
140
141 /**
142 * \brief get tag handle used to store boundary data on SIDESET
143 */
144 inline Tag get_ssTag_data() const { return ssTag_data; }
145
146 /**
147 * \brief get tag handle used to store "id" of BLOCKSET
148 */
149 inline Tag get_bhTag() const { return bhTag; }
150
151 /**
152 * \brief get tag handle used to store of block set header (Used by Cubit)
153 */
154 inline Tag get_bhTag_header() const { return bhTag_header; }
155
156 /**
157 * \brief return pointer to meshset manager
158 */
160
161 /**
162 * \brief return pointer to meshset manager
163 */
164 const MeshsetsManager *get_meshsets_manager_ptr() const { return this; }
165
166 /**
167 * \brief clear multi-index container
168 * @return error code
169 */
171
172 /**
173 * \brier initialize container form data on mesh
174 * @return [description]
175 */
177
178 /**
179 * @brief Boradcats meshsets
180 *
181 * @param verb
182 * @return MoFEMErrorCode
183 */
185
186 /**
187 * @brief Boradcats meshsets
188 *
189 * @param verb
190 * @return MoFEMErrorCode
191 */
193
194 template <class CUBIT_BC_DATA_TYPE>
195 MoFEMErrorCode printBcSet(CUBIT_BC_DATA_TYPE &data,
196 unsigned long int type) const;
197
198 /**
199 * \brief print meshsets with displacement boundary conditions data
200 * structure
201 */
203
204 /**
205 * \brief print meshsets with pressure boundary conditions data structure
206 */
208
209 /**
210 * \brief print meshsets with force boundary conditions data structure
211 */
213
214 /**
215 * \brief print meshsets with temperature boundary conditions data structure
216 */
218
219 /**
220 * \brief print meshsets with heat flux boundary conditions data structure
221 */
223
224 /**
225 * \brief print meshsets with material data structure set on it
226 */
228
230 return cubitMeshsets;
231 }
232
233 /**
234 * \ingroup mofem_meshset_mng
235 * \brief get begin iterator of cubit mehset of given type (instead you can
236 * use _IT_CUBITMESHSETS_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
237 *
238 * for(_IT_CUBITMESHSETS_FOR_LOOP_(mField,it) {
239 * ...
240 * }
241 *
242 */
243 inline CubitMeshSet_multiIndex::iterator getBegin() const {
244 return cubitMeshsets.begin();
245 }
246
247 /**
248 * \ingroup mofem_meshset_mng
249 * \brief get begin iterator of cubit mehset of given type (instead you can
250 * use _IT_CUBITMESHSETS_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
251 *
252 * for(_IT_CUBITMESHSETS_FOR_LOOP_(mField,it) {
253 * ...
254 * }
255 *
256 */
257 CubitMeshSet_multiIndex::iterator getEnd() const {
258 return cubitMeshsets.end();
259 }
260
261 /**
262 * \brief get begin iterator of cubit mehset of given type (instead you can
263 use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
264 * \ingroup mofem_meshset_mng
265
266 *
267 *
268 for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
269 {
270 * ...
271 * }
272 *
273 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
274 */
275 inline CubitMeshsetByType::iterator
276 getBegin(const unsigned int cubit_bc_type) const {
277 return cubitMeshsets.get<CubitMeshsetType_mi_tag>().lower_bound(
278 cubit_bc_type);
279 }
280
281 /**
282 * \brief get begin iterator of cubit mehset of given type (instead you can
283 use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
284 * \ingroup mofem_meshset_mng
285
286 *
287 *
288 for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
289 {
290 * ...
291 * }
292 *
293 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
294 */
295 inline CubitMeshsetByType::iterator
296 getEnd(const unsigned int cubit_bc_type) const {
297 return cubitMeshsets.get<CubitMeshsetType_mi_tag>().upper_bound(
298 cubit_bc_type);
299 }
300
301 /**
302 * \brief get end iterator of cubit meshset of given type (instead you can
303 use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
304 * \ingroup mofem_meshset_mng
305
306 *
307 * for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET,it) {
308 * ...
309 * }
310 *
311 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
312 */
313 inline CubitMeshsetByMask::iterator
314 getBySetTypeBegin(const unsigned int cubit_bc_type) const {
315 return cubitMeshsets.get<CubitMeshsetMaskedType_mi_tag>().lower_bound(
316 cubit_bc_type);
317 }
318
319 /**
320 * \brief get end iterator of cubit mehset of given type (instead you can
321 use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
322 * \ingroup mofem_meshset_mng
323
324 *
325 * for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET,it) {
326 * ...
327 * }
328 *
329 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
330 */
331 inline CubitMeshsetByMask::iterator
332 getBySetTypeEnd(const unsigned int cubit_bc_type) const {
333 return cubitMeshsets.get<CubitMeshsetMaskedType_mi_tag>().upper_bound(
334 cubit_bc_type);
335 }
336
337 /**
338 * \brief get begin iterator of cubit mehset of given type (instead you can
339 use _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
340 * \ingroup mofem_meshset_mng
341
342 *
343 *
344 for(_IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
345 {
346 * ...
347 * }
348 *
349 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
350 */
351 inline CubitMeshsetByName::iterator getBegin(const std::string &name) const {
352 return cubitMeshsets.get<CubitMeshsets_name>().lower_bound(name);
353 }
354
355 /**
356 * \brief get begin iterator of cubit mehset of given type (instead you can
357 use _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
358 * \ingroup mofem_meshset_mng
359
360 *
361 *
362 for(_IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
363 {
364 * ...
365 * }
366 *
367 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
368 */
369 inline CubitMeshsetByName::iterator getEnd(const std::string &name) const {
370 return cubitMeshsets.get<CubitMeshsets_name>().upper_bound(name);
371 }
372
373 /**
374 * \brief check for CUBIT Id and CUBIT type
375 * \ingroup mofem_meshset_mng
376
377 \todo All cubit interface functions should be outsourced to dedicated
378 interface
379
380 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
381 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
382 */
383 bool checkMeshset(const int ms_id, const CubitBCType cubit_bc_type) const;
384
385 /**
386 * \brief check if meshset of given name exist
387 * @param name name of meshset
388 * @return error code
389 */
390 bool checkMeshset(const string name,
391 int *const number_of_meshsets_ptr = NULL) const;
392
393 /**
394 * \brief add cubit meshset
395 * \ingroup mofem_meshset_mng
396
397 *
398 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
399 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET
400 * \param name of set
401
402 */
403 MoFEMErrorCode addMeshset(const CubitBCType cubit_bc_type, const int ms_id,
404 const std::string name = "");
405
406 /**
407 * \brief add entities to cubit meshset
408 * @param cubit_bc_type type of meshset, f.e. NODESET, SIDESET or BLOCKSET
409 * @param ms_id id of meshset
410 * @param ents entities to add
411 * @return error code
412 */
414 const int ms_id, const Range &ents);
415
416 /**
417 * \brief add entities to cubit meshset
418 * @param cubit_bc_type type of meshset, f.e. NODESET, SIDESET or BLOCKSET
419 * @param ms_id id of meshset
420 * @param ents pointer to entities array
421 * @param nb_ents number of entities in array
422 * @return error code
423 */
425 const int ms_id, const EntityHandle *ents,
426 const int nb_ents);
427
428 /**
429 * \brief set attributes to cubit meshset
430 * @param cubit_bc_type type of meshset, see CubitBC, i.e. BLOCKSET,
431 * NODESET, SIDESET
432 * @param ms_id id of meshset
433 * @param attributes attributes
434 * @param name set name to blockset
435 * @return error code
436 */
437 MoFEMErrorCode setAtributes(const CubitBCType cubit_bc_type, const int ms_id,
438 const std::vector<double> &attributes,
439 const std::string name = "");
440
441 /**
442 * \brief set (material) data structure to cubit meshset
443 * @param cubit_bc_type type of meshset, see CubitBC, i.e. BLOCKSET,
444 * NODESET, SIDESET
445 * @param ms_id id of meshset
446 * @param attributes attributes
447 * @return error code
448 */
450 const int ms_id,
451 const GenericAttributeData &data,
452 const std::string name = "");
453
454 /**
455 * \brief set boundary data structure to meshset
456 * @param cubit_bc_type type of meshset, see CubitBC, i.e. BLOCKSET,
457 * NODESET, SIDESET
458 * @param ms_id id of meshset
459 * @param data data structure
460 * @return error code
461 */
462 MoFEMErrorCode setBcData(const CubitBCType cubit_bc_type, const int ms_id,
463 const GenericCubitBcData &data);
464
465 /**
466 * \brief delete cubit meshset
467 * \ingroup mopfem_bc
468
469 *
470 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
471 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
472 *
473 */
474 MoFEMErrorCode deleteMeshset(const CubitBCType cubit_bc_type, const int ms_id,
475 const MoFEMTypes bh = MF_EXIST);
476
477 /**
478 * \brief get cubit meshset
479 * \ingroup mofem_meshset_mng
480 *
481 *
482 */
484 getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type,
485 const CubitMeshSets **cubit_meshset_ptr) const;
486
487 /**
488 * \brief get cubit meshset
489 * \ingroup mofem_meshset_mng
490 *
491 *
492 */
493 const CubitMeshSets *
494 getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type) const;
495
496 /**
497 * @brief Get vector of pointer by bc type
498 *
499 * \ingroup mofem_meshset_mng
500 *
501 * @param std::vector<const CubitMeshSets *>
502 * @return MoFEMErrorCode
503 */
505 getCubitMeshsetPtr(const CubitBCType cubit_bc_type,
506 std::vector<const CubitMeshSets *> &vec_ptr) const;
507
508/**
509 * @brief Get vector of pointer by bc type
510 *
511 * \ingroup mofem_meshset_mng
512 *
513 * @return MoFEMErrorCode
514 */
515 std::vector<const CubitMeshSets *>
516 getCubitMeshsetPtr(const CubitBCType cubit_bc_type) const;
517
518 /**
519 * \brief get cubit meshset
520 *
521 * \ingroup mofem_meshset_mng
522 */
524 getCubitMeshsetPtr(const string name,
525 const CubitMeshSets **cubit_meshset_ptr) const;
526
527 /**
528 * @brief Get vector of pointer to blocksets with name satisfying regular
529 * expression.
530 *
531 * \ingroup mofem_meshset_mng
532 *
533 * @param reg_exp_name
534 * @param std::vector<const CubitMeshSets *>
535 * @return MoFEMErrorCode
536 */
538 getCubitMeshsetPtr(const std::regex reg_exp_name,
539 std::vector<const CubitMeshSets *> &vec_ptr) const;
540
541 /**
542 * @brief Get vector of pointer to blocksets with name satisfying regular
543 * expression.
544 *
545 * \ingroup mofem_meshset_mng
546 *
547 * @param reg_exp_name
548 * @return std::vector<const CubitMeshSets *>
549 */
550 std::vector<const CubitMeshSets *>
551 getCubitMeshsetPtr(const std::regex reg_exp_name) const;
552
553 /**
554 * \brief get entities from CUBIT/meshset of a particular entity dimension
555 * \ingroup mofem_meshset_mng
556
557 * Nodeset can contain nodes, edges, triangles and tets. This applies to
558 other meshsets too.
559 * The nodeset's meshset contain the nodes in the MIDDLE of the surface or
560 volume which is done by default in Cubit,
561 * Hence if all nodes on a particular nodeset are required,
562 * one should get all triangles or tetrahedrons for which the nodeset was
563 create in Cubit,
564 * and get all the connectivities of tris/tets.
565
566 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
567 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
568 * \param dimensions (0 - Nodes, 1 - Edges, 2 - Faces, 3 -
569 Volume(tetrahedral))
570 * \param Range containing the retrieved entities
571 * \param recursive If true, meshsets containing meshsets are queried
572 recursively. Returns the contents of meshsets, but not the meshsets
573 themselves if true.
574 */
576 const unsigned int cubit_bc_type,
577 const int dimension, Range &entities,
578 const bool recursive = true) const;
579
580 /**
581 * \brief get entities related to CUBIT/meshset,
582 * \ingroup mofem_meshset_mng
583
584 * NODESET will get Vertices only, even if the NODESET contains edges, tris
585 and tets
586 * SIDESET will get Tris, BLOCKSET will get Tets, DISPLACEMENTSET and
587 FORCESET are stored in NODESET, PRESSURESET is stored in Sideset.
588
589 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
590 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
591 * \param Range containing the retrieved entities related to the
592 * \param recursive If true, meshsets containing meshsets are queried
593 recursively. Returns the contents of meshsets, but not the meshsets
594 themselves if true.
595 */
597 const unsigned int cubit_bc_type,
598 Range &entities,
599 const bool recursive = true) const;
600
601 /**
602 * \ingroup mofem_meshset_mng
603 * \brief get meshset from CUBIT Id and CUBIT type
604 *
605 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
606 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
607 * \param meshset where to store the retrieved entities
608 */
609 MoFEMErrorCode getMeshset(const int ms_id, const unsigned int cubit_bc_type,
610 EntityHandle &meshset) const;
611
612 /**
613 * @brief Check if meshset constains entities
614 *
615 * @param ms_id
616 * @param cubit_bc_type
617 * @param entities
618 * @param num_entities
619 * @param operation_type
620 * @return true
621 * @return false
622 */
624 const int ms_id, const unsigned int cubit_bc_type,
625 const EntityHandle *entities, int num_entities,
626 const int operation_type = moab::Interface::INTERSECT);
627
628 /**
629 * \ingroup mofem_meshset_mng
630 * \brief get all CUBIT meshsets by CUBIT type
631 *
632 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more).
633 * \param meshsets is range of meshsets
634 */
635 MoFEMErrorCode getMeshsetsByType(const unsigned int cubit_bc_type,
636 Range &meshsets) const;
637
638 /**
639 * \brief add blocksets reading config file
640
641 Example of config file
642 \code
643
644 [block_1001]
645
646 # Example applying attributes to blockset
647
648 id=2001
649 add=BLOCKSET
650 user1=1.0 # attribute value 1
651 user2=2.0 # you can set up to 10 attributes (if needed could be easily
652 extended to more, let us know)
653 user3=3.0
654
655 [block_1002]
656
657 # Example applying material block (isotropic elastic material)
658
659 id=2002
660 add=BLOCKSET
661 name=MAT_ELASTIC
662 young=10
663 poisson=0.25
664 thermalexpansion=0
665
666 [block_1003]
667
668 # Example applying displacement constrains
669
670 id=2003
671 add=NODESET
672
673 # Each flag means that boundary consition on displacements is set.
674 disp_flag1=1 # Setting constrains in x- direction
675 disp_flag2=1 # Setting constrains in y- direction
676 disp_flag3=1 # Setting constrains in z- direction
677 disp_flag4=1 # Setting constrains on rotation over x- axis
678 disp_flag5=1 # Setting constrains on rotation over y- axis
679 disp_flag6=1 # Setting constrains on rotation over z-axis
680 disp_ux=1 # value of disp in x- direction
681 disp_uy=2
682 disp_uz=3
683 disp_rx=4 # value of rotation in y-direction
684 disp_ry=5
685 disp_rz=6
686
687 # Note above values could be interpreted differently if needed.
688
689 [block_1004]
690
691 # Example applying force boundary conditions
692
693 id=2004
694 add=NODESET
695 force_magnitude=1
696 moment_magnitude=1
697 force_fx=1
698 force_fy=1
699 force_fz=1
700 moment_mx=1
701 moment_my=1
702 moment_mz=1
703
704 [block_1005]
705
706 # Example applying pressure boundary conditions
707
708 id=2005
709 add=SIDESET
710 pressure_flag2=1 # 0: Pressure is interpreted as pure pressure 1:
711 pressure is interpreted as total force
712 pressure_magnitude=1
713
714 # Example applying temperature boundary conditions
715
716 [block_1006]
717
718 id=2006
719 add=NODESET
720 temperature_flag1=1 # 0: N/A, 1: temperature value applied
721 temperature_t=1
722
723 [block_1007]
724
725 id=2007
726 add=SIDESET
727 heatflux_flag1=1 # 0: N/A, 1: heat flux applied
728 heatflux_magnitude=1
729
730 [block_1008]
731
732 # Example applying material block (isotropic thermal material)
733
734 id=2008
735 add=BLOCKSET
736 name=MAT_THERMAL # Hast to be set for Thermal Mat
737 conductivity=1
738 capacity=1
739
740 [block_1009]
741
742 # Example applying interface
743 id=2009
744 add=SIDESET
745 interface_type=1
746
747 [block_1010]
748
749 # Example applying material block for interface element
750
751 id=2010
752 add=BLOCKSET
753 name=MAT_INTERF
754 interface_alpha = 1
755 interface_beta = 0
756 interface_ft = 1
757 interface_Gf = 1
758
759
760 [block_1009]
761
762 # Example applying material block (isotropic trans iso material)
763
764 id=2011
765 add=BLOCKSET
766 name=MAT_ELASTIC_TRANS_ISO
767 Youngp=1
768 Youngz=2
769 Poissonp=3
770 Poissonpz=4
771 Shearzp=5
772
773 [SET_ATTR_foo]
774
775 # Example set atttributes to block name "foo"
776 number_of_attributes=3
777 user1=1
778 user2=2
779 user3=3
780
781 \endcode
782
783 * @param file_name config file
784 * @return error code
785
786 */
787 MoFEMErrorCode setMeshsetFromFile(const string file_name,
788 const bool clean_file_options = true);
789
790 /**
791 * \brief get name of config file from line command '-meshsets_config'
792 * @return error code
793
794 Option is "-meshsets_config file_name.cfg"
795
796 */
798
799 /**
800 * @brief save cubit meshset entities on the moab mesh
801 *
802 * @param ms_id id of the cubit meshset (NODESET SIDESET BLOCKSET)
803 * @param cubit_bc_type type of a cubit mesheset
804 * @param file_name optional name for the file
805 * @param file_type optional file type for moab (VTK MOAB)
806 * @param options optional parameters for moab writer (PARALLEL=WRITE_PART)
807 * @return MoFEMErrorCode
808 */
810 saveMeshsetToFile(const int ms_id, const unsigned int cubit_bc_type,
811 const std::string file_name = "out_meshset.vtk",
812 const std::string file_type = "VTK",
813 const std::string options = "") const;
814
815 /**
816 * @brief save cubit meshset entities on the moab mesh
817 *
818 * @param ms_id id of the cubit meshset
819 * @param cubit_bc_type type of a cubit mesheset (NODESET SIDESET BLOCKSET)
820 * @param dim dimension of the entities
821 * @param file_name optional name for the file
822 * @param file_type optional file type for moab (VTK MOAB)
823 * @param options optional parameters for moab writer (PARALLEL=WRITE_PART)
824 * @return MoFEMErrorCode
825 */
827 const int ms_id, const unsigned int cubit_bc_type, const int dim,
828 const std::string file_name = "out_meshset.vtk",
829 const bool recursive = false, const std::string file_type = "VTK",
830 const std::string options = "") const;
831
832 /**
833 * \brief Get config file options, use with care
834 * @return error code
835 */
836 inline boost::shared_ptr<boost::program_options::options_description> &
839 }
840
842
843 static bool brodcastMeshsets; ///< if true meshsets are synchrinised between
844 ///< processors
845
846protected:
847 Tag nsTag;
848 Tag ssTag;
851 Tag bhTag;
853
854 // cubit
856 boost::shared_ptr<boost::program_options::options_description>
857 configFileOptionsPtr; ///< config file options
858};
859
860template <class CUBIT_BC_DATA_TYPE>
862 unsigned long int type) const {
864 const MoFEM::Interface &m_field = cOre;
865 const moab::Interface &moab = m_field.get_moab();
866 for (_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_((*this), type, it)) {
867 CHKERR it->getBcDataStructure(data);
868 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *it;
869 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << data;
870 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << "name " << it->getName();
871 for (EntityType t = MBVERTEX; t != MBENTITYSET; ++t) {
872 int nb;
873 CHKERR moab.get_number_entities_by_type(it->meshset, t, nb, true);
874 MOFEM_LOG("MeshsetMngWorld", Sev::inform)
875 << "msId " << it->getMeshsetId() << " number of "
876 << moab::CN::EntityTypeName(t) << " " << nb;
877 }
878 }
880}
881
882} // namespace MoFEM
883
884#endif //__MESHSETSMANAGER_HPP__
885
886/**
887 * \defgroup mofem_meshset_mng MeshsetsManager
888 * \brief Interface for meshsets with entities with data and boundary conditions
889 *
890 * \ingroup mofem
891 **/
@ DEFAULT_VERBOSITY
Definition: definitions.h:207
MoFEMTypes
Those types control how functions respond on arguments, f.e. error handling.
Definition: definitions.h:97
@ MF_EXIST
Definition: definitions.h:100
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
const int dim
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:301
CubitMeshsetByType::iterator getEnd(const unsigned int cubit_bc_type) const
get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE...
CubitMeshsetByName::iterator getEnd(const std::string &name) const
get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_BY_SET_TYPE_FO...
MoFEMErrorCode getMeshset(const int ms_id, const unsigned int cubit_bc_type, EntityHandle &meshset) const
get meshset from CUBIT Id and CUBIT type
bool checkMeshset(const int ms_id, const CubitBCType cubit_bc_type) const
check for CUBIT Id and CUBIT type
CubitMeshSet_multiIndex::iterator getBegin() const
get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_TYPE_FOR_LOOP(...
#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet in a moFEM field.
CubitMeshsetByMask::iterator getBySetTypeEnd(const unsigned int cubit_bc_type) const
get end iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE_F...
MoFEMErrorCode addMeshset(const CubitBCType cubit_bc_type, const int ms_id, const std::string name="")
add cubit meshset
CubitMeshsetByName::iterator getBegin(const std::string &name) const
get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_BY_SET_TYPE_FO...
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 mehset of given type (instead you can use IT_CUBITMESHSETS_BY_BCDATA_TYPE...
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
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_...
CubitMeshSet_multiIndex::iterator getEnd() const
get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_TYPE_FOR_LOOP(...
auto bit
set bit
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
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::getMaksedBcTypeULong > >, 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::getMaksedBcTypeULong > > > > > 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:59
virtual moab::Interface & get_moab()=0
Core (interface) class.
Definition: Core.hpp:82
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 printForceSet() const
print meshsets with force boundary conditions data structure
MoFEMErrorCode saveMeshsetToFile(const int ms_id, const unsigned int cubit_bc_type, const std::string file_name="out_meshset.vtk", const std::string file_type="VTK", const std::string options="") const
save cubit meshset entities on the moab mesh
MoFEMErrorCode setBcData(const CubitBCType cubit_bc_type, const int ms_id, const GenericCubitBcData &data)
set boundary data structure to meshset
const MeshsetsManager * get_meshsets_manager_ptr() const
return pointer to meshset manager
MoFEMErrorCode broadcastMeshsets(int verb=DEFAULT_VERBOSITY)
Boradcats meshsets.
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=DEFAULT_VERBOSITY)
Tag get_bhTag() const
get tag handle used to store "id" of BLOCKSET
MoFEMErrorCode setAtributes(const CubitBCType cubit_bc_type, const int ms_id, const std::vector< double > &attributes, const std::string name="")
set attributes to cubit meshset
MoFEMErrorCode deleteMeshset(const CubitBCType cubit_bc_type, const int ms_id, const MoFEMTypes bh=MF_EXIST)
delete cubit meshset
MeshsetsManager * get_meshsets_manager_ptr()
return pointer to meshset manager
MoFEMErrorCode updateAllMeshsetsByEntitiesChildren(const BitRefLevel bit)
MoFEMErrorCode clearMap()
clear multi-index container
MoFEMErrorCode addEntitiesToMeshset(const CubitBCType cubit_bc_type, const int ms_id, const Range &ents)
add entities to cubit meshset
bool checkIfMeshsetContainsEntities(const int ms_id, const unsigned int cubit_bc_type, const EntityHandle *entities, int num_entities, const int operation_type=moab::Interface::INTERSECT)
Check if meshset constains entities.
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
boost::shared_ptr< boost::program_options::options_description > & getConfigFileOptionsPtr()
Get config file options, use with care.
MoFEMErrorCode printPressureSet() const
print meshsets with pressure boundary conditions data structure
MoFEMErrorCode printBcSet(CUBIT_BC_DATA_TYPE &data, unsigned long int type) const
MoFEMErrorCode printMaterialsSet() const
print meshsets with material data structure set on it
MoFEMErrorCode setMeshsetFromFile()
get name of config file from line command '-meshsets_config'
CubitMeshSet_multiIndex & getMeshsetsMultindex()
MoFEMErrorCode setAtributesByDataStructure(const CubitBCType cubit_bc_type, const int ms_id, const GenericAttributeData &data, const std::string name="")
set (material) data structure to cubit meshset
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
MoFEMErrorCode readMeshsets(int verb=DEFAULT_VERBOSITY)
Boradcats meshsets.
virtual ~MeshsetsManager()=default
MoFEMErrorCode printHeatFluxSet() const
print meshsets with heat flux boundary conditions data structure
MoFEMErrorCode printTemperatureSet() const
print meshsets with temperature boundary conditions data structure
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
MoFEMErrorCode getTags(int verb=-1)
get tags handlers used on meshsets
boost::shared_ptr< boost::program_options::options_description > configFileOptionsPtr
config file options
MoFEMErrorCode printDisplacementSet() const
print meshsets with displacement boundary conditions data structure
base class for all interface classes