v0.14.0
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 * \code
548 for (auto m :
549 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
550
551 (boost::format("%s(.*)") % block_name).str()
552
553 ))
554
555 ) {
556 MOFEM_LOG("WORLD", Sev::inform) << m->getName();
557
558 Rants ents;
559 m_field.get_moab().get_entities_by_dimension(
560 m->getMeshset(), 0, ents, false);
561
562 auto print_vets = [](boost::shared_ptr<FieldEntity> ent_ptr) {
563 MoFEMFunctionBegin;
564 if(!(ent_ptr->getPStatus() & PSTATUS_NOT_OWNED)) {
565 MOFEM_LOG("SYNC", Sev::inform) << ents_ptr->getName() << ": " <<
566 ent_ptr->getEntFieldData();
567 }
568 MoFEMFunctionReturn(0);
569 };
570
571 CHKERR m_field.getInterface<FieldBlas>()->fieldLambdaOnEntities(
572 print_vets, "VELOCITIES", &ents);
573 CHKERR m_field.getInterface<FieldBlas>()->fieldLambdaOnEntities(
574 print_vets, "DISPLACEMENTS", &ents);
575 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::ifrom);
576 }
577 * \endcode
578 *
579 * @param reg_exp_name
580 * @return std::vector<const CubitMeshSets *>
581 */
582 std::vector<const CubitMeshSets *>
583 getCubitMeshsetPtr(const std::regex reg_exp_name) const;
584
585 /**
586 * \brief get entities from CUBIT/meshset of a particular entity dimension
587 * \ingroup mofem_meshset_mng
588
589 * Nodeset can contain nodes, edges, triangles and tets. This applies to
590 other meshsets too.
591 * The nodeset's meshset contain the nodes in the MIDDLE of the surface or
592 volume which is done by default in Cubit,
593 * Hence if all nodes on a particular nodeset are required,
594 * one should get all triangles or tetrahedrons for which the nodeset was
595 create in Cubit,
596 * and get all the connectivities of tris/tets.
597
598 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
599 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
600 * \param dimensions (0 - Nodes, 1 - Edges, 2 - Faces, 3 -
601 Volume(tetrahedral))
602 * \param Range containing the retrieved entities
603 * \param recursive If true, meshsets containing meshsets are queried
604 recursively. Returns the contents of meshsets, but not the meshsets
605 themselves if true.
606 */
608 const unsigned int cubit_bc_type,
609 const int dimension, Range &entities,
610 const bool recursive = true) const;
611
612 /**
613 * \brief get entities related to CUBIT/meshset,
614 * \ingroup mofem_meshset_mng
615
616 * NODESET will get Vertices only, even if the NODESET contains edges, tris
617 and tets
618 * SIDESET will get Tris, BLOCKSET will get Tets, DISPLACEMENTSET and
619 FORCESET are stored in NODESET, PRESSURESET is stored in Sideset.
620
621 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
622 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
623 * \param Range containing the retrieved entities related to the
624 * \param recursive If true, meshsets containing meshsets are queried
625 recursively. Returns the contents of meshsets, but not the meshsets
626 themselves if true.
627 */
629 const unsigned int cubit_bc_type,
630 Range &entities,
631 const bool recursive = true) const;
632
633 /**
634 * \ingroup mofem_meshset_mng
635 * \brief get meshset from CUBIT Id and CUBIT type
636 *
637 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
638 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
639 * \param meshset where to store the retrieved entities
640 */
641 MoFEMErrorCode getMeshset(const int ms_id, const unsigned int cubit_bc_type,
642 EntityHandle &meshset) const;
643
644 /**
645 * @brief Check if meshset constains entities
646 *
647 * @param ms_id
648 * @param cubit_bc_type
649 * @param entities
650 * @param num_entities
651 * @param operation_type
652 * @return true
653 * @return false
654 */
656 const int ms_id, const unsigned int cubit_bc_type,
657 const EntityHandle *entities, int num_entities,
658 const int operation_type = moab::Interface::INTERSECT);
659
660 /**
661 * \ingroup mofem_meshset_mng
662 * \brief get all CUBIT meshsets by CUBIT type
663 *
664 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more).
665 * \param meshsets is range of meshsets
666 */
667 MoFEMErrorCode getMeshsetsByType(const unsigned int cubit_bc_type,
668 Range &meshsets) const;
669
670 /**
671 * \brief add blocksets reading config file
672
673 Example of config file
674 \code
675
676 [block_1001]
677
678 # Example applying attributes to blockset
679
680 id=2001
681 add=BLOCKSET
682 user1=1.0 # attribute value 1
683 user2=2.0 # you can set up to 10 attributes (if needed could be easily
684 extended to more, let us know)
685 user3=3.0
686
687 [block_1002]
688
689 # Example applying material block (isotropic elastic material)
690
691 id=2002
692 add=BLOCKSET
693 name=MAT_ELASTIC
694 young=10
695 poisson=0.25
696 thermalexpansion=0
697
698 [block_1003]
699
700 # Example applying displacement constrains
701
702 id=2003
703 add=NODESET
704
705 # Each flag means that boundary consition on displacements is set.
706 disp_flag1=1 # Setting constrains in x- direction
707 disp_flag2=1 # Setting constrains in y- direction
708 disp_flag3=1 # Setting constrains in z- direction
709 disp_flag4=1 # Setting constrains on rotation over x- axis
710 disp_flag5=1 # Setting constrains on rotation over y- axis
711 disp_flag6=1 # Setting constrains on rotation over z-axis
712 disp_ux=1 # value of disp in x- direction
713 disp_uy=2
714 disp_uz=3
715 disp_rx=4 # value of rotation in y-direction
716 disp_ry=5
717 disp_rz=6
718
719 # Note above values could be interpreted differently if needed.
720
721 [block_1004]
722
723 # Example applying force boundary conditions
724
725 id=2004
726 add=NODESET
727 force_magnitude=1
728 moment_magnitude=1
729 force_fx=1
730 force_fy=1
731 force_fz=1
732 moment_mx=1
733 moment_my=1
734 moment_mz=1
735
736 [block_1005]
737
738 # Example applying pressure boundary conditions
739
740 id=2005
741 add=SIDESET
742 pressure_flag2=1 # 0: Pressure is interpreted as pure pressure 1:
743 pressure is interpreted as total force
744 pressure_magnitude=1
745
746 # Example applying temperature boundary conditions
747
748 [block_1006]
749
750 id=2006
751 add=NODESET
752 temperature_flag1=1 # 0: N/A, 1: temperature value applied
753 temperature_t=1
754
755 [block_1007]
756
757 id=2007
758 add=SIDESET
759 heatflux_flag1=1 # 0: N/A, 1: heat flux applied
760 heatflux_magnitude=1
761
762 [block_1008]
763
764 # Example applying material block (isotropic thermal material)
765
766 id=2008
767 add=BLOCKSET
768 name=MAT_THERMAL # Hast to be set for Thermal Mat
769 conductivity=1
770 capacity=1
771
772 [block_1009]
773
774 # Example applying interface
775 id=2009
776 add=SIDESET
777 interface_type=1
778
779 [block_1010]
780
781 # Example applying material block for interface element
782
783 id=2010
784 add=BLOCKSET
785 name=MAT_INTERF
786 interface_alpha = 1
787 interface_beta = 0
788 interface_ft = 1
789 interface_Gf = 1
790
791
792 [block_1009]
793
794 # Example applying material block (isotropic trans iso material)
795
796 id=2011
797 add=BLOCKSET
798 name=MAT_ELASTIC_TRANS_ISO
799 Youngp=1
800 Youngz=2
801 Poissonp=3
802 Poissonpz=4
803 Shearzp=5
804
805 [SET_ATTR_foo]
806
807 # Example set atttributes to block name "foo"
808 number_of_attributes=3
809 user1=1
810 user2=2
811 user3=3
812
813 \endcode
814
815 * @param file_name config file
816 * @return error code
817
818 */
819 MoFEMErrorCode setMeshsetFromFile(const string file_name,
820 const bool clean_file_options = true);
821
822 /**
823 * \brief get name of config file from line command '-meshsets_config'
824 * @return error code
825
826 Option is "-meshsets_config file_name.cfg"
827
828 */
830
831 /**
832 * @brief save cubit meshset entities on the moab mesh
833 *
834 * @param ms_id id of the cubit meshset (NODESET SIDESET BLOCKSET)
835 * @param cubit_bc_type type of a cubit mesheset
836 * @param file_name optional name for the file
837 * @param file_type optional file type for moab (VTK MOAB)
838 * @param options optional parameters for moab writer (PARALLEL=WRITE_PART)
839 * @return MoFEMErrorCode
840 */
842 saveMeshsetToFile(const int ms_id, const unsigned int cubit_bc_type,
843 const std::string file_name = "out_meshset.vtk",
844 const std::string file_type = "VTK",
845 const std::string options = "") const;
846
847 /**
848 * @brief save cubit meshset entities on the moab mesh
849 *
850 * @param ms_id id of the cubit meshset
851 * @param cubit_bc_type type of a cubit mesheset (NODESET SIDESET BLOCKSET)
852 * @param dim dimension of the entities
853 * @param file_name optional name for the file
854 * @param file_type optional file type for moab (VTK MOAB)
855 * @param options optional parameters for moab writer (PARALLEL=WRITE_PART)
856 * @return MoFEMErrorCode
857 */
859 const int ms_id, const unsigned int cubit_bc_type, const int dim,
860 const std::string file_name = "out_meshset.vtk",
861 const bool recursive = false, const std::string file_type = "VTK",
862 const std::string options = "") const;
863
864 /**
865 * \brief Get config file options, use with care
866 * @return error code
867 */
868 inline boost::shared_ptr<boost::program_options::options_description> &
871 }
872
873 /**
874 * @brief Update all blolsets, sidesets and node sets
875 *
876 * @param bit
877 * @return MoFEMErrorCode
878 */
880
881 static bool brodcastMeshsets; ///< if true meshsets are synchrinised between
882 ///< processors
883
884protected:
885 Tag nsTag;
886 Tag ssTag;
889 Tag bhTag;
891
892 // cubit
894 boost::shared_ptr<boost::program_options::options_description>
895 configFileOptionsPtr; ///< config file options
896};
897
898template <class CUBIT_BC_DATA_TYPE>
900 unsigned long int type) const {
902 const MoFEM::Interface &m_field = cOre;
903 const moab::Interface &moab = m_field.get_moab();
904 for (auto it : getCubitMeshsetPtr(type)) {
905 CHKERR it->getBcDataStructure(data);
906 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *it;
907 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << data;
908 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << "name " << it->getName();
909 for (EntityType t = MBVERTEX; t != MBENTITYSET; ++t) {
910 int nb;
911 CHKERR moab.get_number_entities_by_type(it->meshset, t, nb, true);
912 if (nb > 0) {
913 MOFEM_LOG("MeshsetMngSync", Sev::inform)
914 << "msId " << it->getMeshsetId() << " number of "
915 << moab::CN::EntityTypeName(t) << " " << nb;
916 }
917 }
918 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::inform);
919 }
921}
922
923} // namespace MoFEM
924
925#endif //__MESHSETSMANAGER_HPP__
926
927/**
928 * \defgroup mofem_meshset_mng MeshsetsManager
929 * \brief Interface for meshsets with entities with data and boundary conditions
930 *
931 * \ingroup mofem
932 **/
#define MOFEM_LOG_SEVERITY_SYNC(comm, severity)
Synchronise "SYNC" on curtain severity level.
Definition: LogManager.hpp:352
@ 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:308
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(...
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
virtual MPI_Comm & get_comm() const =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 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
MoFEMErrorCode updateAllMeshsetsByEntitiesChildren(const BitRefLevel &bit)
Update all blolsets, sidesets and node sets.
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