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