v0.15.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 static MoFEMErrorCode getTags(moab::Interface &moab, Tag &nsTag, Tag &ssTag,
128 Tag &bhTag_header, int verb = -1);
129
130 /**
131 * \brief get tag handle used to store "id" of NODESET
132 */
133 inline Tag get_nsTag() const { return nsTag; }
134
135 /**
136 * \brief get tag handle used to store "id" of SIDESET
137 */
138 inline Tag get_ssTag() const { return ssTag; }
139
140 /**
141 * \brief get tag handle used to store boundary data on NODESET
142 */
143 inline Tag get_nsTag_data() const { return nsTag_data; }
144
145 /**
146 * \brief get tag handle used to store boundary data on SIDESET
147 */
148 inline Tag get_ssTag_data() const { return ssTag_data; }
149
150 /**
151 * \brief get tag handle used to store "id" of BLOCKSET
152 */
153 inline Tag get_bhTag() const { return bhTag; }
154
155 /**
156 * \brief get tag handle used to store of block set header (Used by Cubit)
157 */
158 inline Tag get_bhTag_header() const { return bhTag_header; }
159
160 /**
161 * \brief return pointer to meshset manager
162 */
164
165 /**
166 * \brief return pointer to meshset manager
167 */
168 const MeshsetsManager *get_meshsets_manager_ptr() const { return this; }
169
170 /**
171 * \brief clear multi-index container
172 * @return error code
173 */
175
176 /**
177 * \brier initialize container form data on mesh
178 * @return [description]
179 */
181
182 /**
183 * @brief Read meshsets
184 *
185 * @param verb
186 * @return MoFEMErrorCode
187 */
189
190 /**
191 * @brief Broadcast meshsets
192 *
193 * @param verb
194 * @return MoFEMErrorCode
195 */
197
198 template <class CUBIT_BC_DATA_TYPE>
199 MoFEMErrorCode printBcSet(CUBIT_BC_DATA_TYPE &data,
200 unsigned long int type) const;
201
202 /**
203 * \brief print meshsets with displacement boundary conditions data
204 * structure
205 */
207
208 /**
209 * \brief print meshsets with pressure boundary conditions data structure
210 */
212
213 /**
214 * \brief print meshsets with force boundary conditions data structure
215 */
217
218 /**
219 * \brief print meshsets with temperature boundary conditions data structure
220 */
222
223 /**
224 * \brief print meshsets with heat flux boundary conditions data structure
225 */
227
228 /**
229 * \brief print meshsets with material data structure set on it
230 */
232
236
237 /**
238 * \ingroup mofem_meshset_mng
239 * \brief get begin iterator of cubit mehset of given type (instead you can
240 * use _IT_CUBITMESHSETS_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
241 *
242 * for(_IT_CUBITMESHSETS_FOR_LOOP_(mField,it) {
243 * ...
244 * }
245 *
246 */
247 inline CubitMeshSet_multiIndex::iterator getBegin() const {
248 return cubitMeshsets.begin();
249 }
250
251 /**
252 * \ingroup mofem_meshset_mng
253 * \brief get begin iterator of cubit mehset of given type (instead you can
254 * use _IT_CUBITMESHSETS_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
255 *
256 * for(_IT_CUBITMESHSETS_FOR_LOOP_(mField,it) {
257 * ...
258 * }
259 *
260 */
261 CubitMeshSet_multiIndex::iterator getEnd() const {
262 return cubitMeshsets.end();
263 }
264
265 /**
266 * \brief get begin iterator of cubit mehset of given type (instead you can
267 use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
268 * \ingroup mofem_meshset_mng
269
270 *
271 *
272 for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
273 {
274 * ...
275 * }
276 *
277 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
278 */
279 inline CubitMeshsetByType::iterator
280 getBegin(const unsigned int cubit_bc_type) const {
281 return cubitMeshsets.get<CubitMeshsetType_mi_tag>().lower_bound(
282 cubit_bc_type);
283 }
284
285 /**
286 * \brief get begin iterator of cubit mehset of given type (instead you can
287 use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
288 * \ingroup mofem_meshset_mng
289
290 *
291 *
292 for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
293 {
294 * ...
295 * }
296 *
297 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
298 */
299 inline CubitMeshsetByType::iterator
300 getEnd(const unsigned int cubit_bc_type) const {
301 return cubitMeshsets.get<CubitMeshsetType_mi_tag>().upper_bound(
302 cubit_bc_type);
303 }
304
305 /**
306 * \brief get end iterator of cubit meshset of given type (instead you can
307 use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
308 * \ingroup mofem_meshset_mng
309
310 *
311 * for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET,it) {
312 * ...
313 * }
314 *
315 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
316 */
317 inline CubitMeshsetByMask::iterator
318 getBySetTypeBegin(const unsigned int cubit_bc_type) const {
319 return cubitMeshsets.get<CubitMeshsetMaskedType_mi_tag>().lower_bound(
320 cubit_bc_type);
321 }
322
323 /**
324 * \brief get end iterator of cubit mehset of given type (instead you can
325 use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
326 * \ingroup mofem_meshset_mng
327
328 *
329 * for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET,it) {
330 * ...
331 * }
332 *
333 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
334 */
335 inline CubitMeshsetByMask::iterator
336 getBySetTypeEnd(const unsigned int cubit_bc_type) const {
337 return cubitMeshsets.get<CubitMeshsetMaskedType_mi_tag>().upper_bound(
338 cubit_bc_type);
339 }
340
341 /**
342 * \brief get begin iterator of cubit mehset of given type (instead you can
343 use _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
344 * \ingroup mofem_meshset_mng
345
346 *
347 *
348 for(_IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
349 {
350 * ...
351 * }
352 *
353 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
354 */
355 inline CubitMeshsetByName::iterator getBegin(const std::string &name) const {
356 return cubitMeshsets.get<CubitMeshsets_name>().lower_bound(name);
357 }
358
359 /**
360 * \brief get begin iterator of cubit mehset of given type (instead you can
361 use _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
362 * \ingroup mofem_meshset_mng
363
364 *
365 *
366 for(_IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
367 {
368 * ...
369 * }
370 *
371 * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
372 */
373 inline CubitMeshsetByName::iterator getEnd(const std::string &name) const {
374 return cubitMeshsets.get<CubitMeshsets_name>().upper_bound(name);
375 }
376
377 /**
378 * \brief check for CUBIT Id and CUBIT type
379 * \ingroup mofem_meshset_mng
380
381 \todo All cubit interface functions should be outsourced to dedicated
382 interface
383
384 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
385 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
386 */
387 bool checkMeshset(const int ms_id, const CubitBCType cubit_bc_type) const;
388
389 /**
390 * \brief check if meshset of given name exist
391 * @param name name of meshset
392 * @return error code
393 */
394 bool checkMeshset(const string name,
395 int *const number_of_meshsets_ptr = NULL) const;
396
397 /**
398 * \brief add cubit meshset
399 * \ingroup mofem_meshset_mng
400
401 *
402 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
403 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET
404 * \param name of set
405
406 */
407 MoFEMErrorCode addMeshset(const CubitBCType cubit_bc_type, const int ms_id,
408 const std::string name = "");
409
410 /**
411 * \brief add entities to cubit meshset
412 * @param cubit_bc_type type of meshset, f.e. NODESET, SIDESET or BLOCKSET
413 * @param ms_id id of meshset
414 * @param ents entities to add
415 * @return error code
416 */
418 const int ms_id, const Range &ents);
419
420 /**
421 * \brief add entities to cubit meshset
422 * @param cubit_bc_type type of meshset, f.e. NODESET, SIDESET or BLOCKSET
423 * @param ms_id id of meshset
424 * @param ents pointer to entities array
425 * @param nb_ents number of entities in array
426 * @return error code
427 */
429 const int ms_id, const EntityHandle *ents,
430 const int nb_ents);
431
432 /**
433 * \brief set attributes to cubit meshset
434 * @param cubit_bc_type type of meshset, see CubitBC, i.e. BLOCKSET,
435 * NODESET, SIDESET
436 * @param ms_id id of meshset
437 * @param attributes attributes
438 * @param name set name to blockset
439 * @return error code
440 */
441 MoFEMErrorCode setAtributes(const CubitBCType cubit_bc_type, const int ms_id,
442 const std::vector<double> &attributes,
443 const std::string name = "");
444
445 /**
446 * \brief set (material) data structure to cubit meshset
447 * @param cubit_bc_type type of meshset, see CubitBC, i.e. BLOCKSET,
448 * NODESET, SIDESET
449 * @param ms_id id of meshset
450 * @param attributes attributes
451 * @return error code
452 */
454 const int ms_id,
455 const GenericAttributeData &data,
456 const std::string name = "");
457
458 /**
459 * \brief set boundary data structure to meshset
460 * @param cubit_bc_type type of meshset, see CubitBC, i.e. BLOCKSET,
461 * NODESET, SIDESET
462 * @param ms_id id of meshset
463 * @param data data structure
464 * @return error code
465 */
466 MoFEMErrorCode setBcData(const CubitBCType cubit_bc_type, const int ms_id,
467 const GenericCubitBcData &data);
468
469 /**
470 * \brief delete cubit meshset
471 * \ingroup mopfem_bc
472
473 *
474 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
475 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
476 *
477 */
478 MoFEMErrorCode deleteMeshset(const CubitBCType cubit_bc_type, const int ms_id,
479 const MoFEMTypes bh = MF_EXIST);
480
481 /**
482 * \brief get cubit meshset
483 * \ingroup mofem_meshset_mng
484 *
485 *
486 */
488 getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type,
489 const CubitMeshSets **cubit_meshset_ptr) const;
490
491 /**
492 * \brief get cubit meshset
493 * \ingroup mofem_meshset_mng
494 *
495 *
496 */
497 const CubitMeshSets *
498 getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type) const;
499
500 /**
501 * @brief Get vector of pointer by bc type
502 *
503 * \ingroup mofem_meshset_mng
504 *
505 * @param std::vector<const CubitMeshSets *>
506 * @return MoFEMErrorCode
507 */
509 getCubitMeshsetPtr(const CubitBCType cubit_bc_type,
510 std::vector<const CubitMeshSets *> &vec_ptr) const;
511
512/**
513 * @brief Get vector of pointer by bc type
514 *
515 * \ingroup mofem_meshset_mng
516 *
517 * @return MoFEMErrorCode
518 */
519 std::vector<const CubitMeshSets *>
520 getCubitMeshsetPtr(const CubitBCType cubit_bc_type) const;
521
522 /**
523 * \brief get cubit meshset
524 *
525 * \ingroup mofem_meshset_mng
526 */
528 getCubitMeshsetPtr(const string name,
529 const CubitMeshSets **cubit_meshset_ptr) const;
530
531 /**
532 * @brief Get vector of pointer to blocksets with name satisfying regular
533 * expression.
534 *
535 * \ingroup mofem_meshset_mng
536 *
537 * @param reg_exp_name
538 * @param std::vector<const CubitMeshSets *>
539 * @return MoFEMErrorCode
540 */
542 getCubitMeshsetPtr(const std::regex reg_exp_name,
543 std::vector<const CubitMeshSets *> &vec_ptr) const;
544
545 /**
546 * @brief Get vector of pointer to blocksets with name satisfying regular
547 * expression.
548 *
549 * \ingroup mofem_meshset_mng
550 *
551 * \code
552 for (auto m :
553 m_field.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
554
555 (boost::format("%s(.*)") % block_name).str()
556
557 ))
558
559 ) {
560 MOFEM_LOG("WORLD", Sev::inform) << m->getName();
561
562 Rants ents;
563 m_field.get_moab().get_entities_by_dimension(
564 m->getMeshset(), 0, ents, false);
565
566 auto print_vets = [](boost::shared_ptr<FieldEntity> ent_ptr) {
567 MoFEMFunctionBegin;
568 if(!(ent_ptr->getPStatus() & PSTATUS_NOT_OWNED)) {
569 MOFEM_LOG("SYNC", Sev::inform) << ents_ptr->getName() << ": " <<
570 ent_ptr->getEntFieldData();
571 }
572 MoFEMFunctionReturn(0);
573 };
574
575 CHKERR m_field.getInterface<FieldBlas>()->fieldLambdaOnEntities(
576 print_vets, "VELOCITIES", &ents);
577 CHKERR m_field.getInterface<FieldBlas>()->fieldLambdaOnEntities(
578 print_vets, "DISPLACEMENTS", &ents);
579 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::ifrom);
580 }
581 * \endcode
582 *
583 * @param reg_exp_name
584 * @return std::vector<const CubitMeshSets *>
585 */
586 std::vector<const CubitMeshSets *>
587 getCubitMeshsetPtr(const std::regex reg_exp_name) const;
588
589 /**
590 * \brief get entities from CUBIT/meshset of a particular entity dimension
591 * \ingroup mofem_meshset_mng
592
593 * Nodeset can contain nodes, edges, triangles and tets. This applies to
594 other meshsets too.
595 * The nodeset's meshset contain the nodes in the MIDDLE of the surface or
596 volume which is done by default in Cubit,
597 * Hence if all nodes on a particular nodeset are required,
598 * one should get all triangles or tetrahedrons for which the nodeset was
599 create in Cubit,
600 * and get all the connectivities of tris/tets.
601
602 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
603 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
604 * \param dimensions (0 - Nodes, 1 - Edges, 2 - Faces, 3 -
605 Volume(tetrahedral))
606 * \param Range containing the retrieved entities
607 * \param recursive If true, meshsets containing meshsets are queried
608 recursively. Returns the contents of meshsets, but not the meshsets
609 themselves if true.
610 */
612 const unsigned int cubit_bc_type,
613 const int dimension, Range &entities,
614 const bool recursive = true) const;
615
616 /**
617 * \brief get entities related to CUBIT/meshset,
618 * \ingroup mofem_meshset_mng
619
620 * NODESET will get Vertices only, even if the NODESET contains edges, tris
621 and tets
622 * SIDESET will get Tris, BLOCKSET will get Tets, DISPLACEMENTSET and
623 FORCESET are stored in NODESET, PRESSURESET is stored in Sideset.
624
625 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
626 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
627 * \param Range containing the retrieved entities related to the
628 * \param recursive If true, meshsets containing meshsets are queried
629 recursively. Returns the contents of meshsets, but not the meshsets
630 themselves if true.
631 */
633 const unsigned int cubit_bc_type,
634 Range &entities,
635 const bool recursive = true) const;
636
637 /**
638 * \ingroup mofem_meshset_mng
639 * \brief get meshset from CUBIT Id and CUBIT type
640 *
641 * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
642 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
643 * \param meshset where to store the retrieved entities
644 */
645 MoFEMErrorCode getMeshset(const int ms_id, const unsigned int cubit_bc_type,
646 EntityHandle &meshset) const;
647
648 /**
649 * @brief Check if meshset constains entities
650 *
651 * @param ms_id
652 * @param cubit_bc_type
653 * @param entities
654 * @param num_entities
655 * @param operation_type
656 * @return true
657 * @return false
658 */
660 const int ms_id, const unsigned int cubit_bc_type,
661 const EntityHandle *entities, int num_entities,
662 const int operation_type = moab::Interface::INTERSECT);
663
664 /**
665 * \ingroup mofem_meshset_mng
666 * \brief get all CUBIT meshsets by CUBIT type
667 *
668 * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more).
669 * \param meshsets is range of meshsets
670 */
671 MoFEMErrorCode getMeshsetsByType(const unsigned int cubit_bc_type,
672 Range &meshsets) const;
673
674 /**
675 * \brief add blocksets reading config file
676
677 Example of config file
678 \code
679
680 [block_1001]
681
682 # Example applying attributes to blockset
683
684 id=2001
685 add=BLOCKSET
686 user1=1.0 # attribute value 1
687 user2=2.0 # you can set up to 10 attributes (if needed could be easily
688 extended to more, let us know)
689 user3=3.0
690
691 [block_1002]
692
693 # Example applying material block (isotropic elastic material)
694
695 id=2002
696 add=BLOCKSET
697 name=MAT_ELASTIC
698 young=10
699 poisson=0.25
700 thermalexpansion=0
701
702 [block_1003]
703
704 # Example applying displacement constrains
705
706 id=2003
707 add=NODESET
708
709 # Each flag means that boundary consition on displacements is set.
710 disp_flag1=1 # Setting constrains in x- direction
711 disp_flag2=1 # Setting constrains in y- direction
712 disp_flag3=1 # Setting constrains in z- direction
713 disp_flag4=1 # Setting constrains on rotation over x- axis
714 disp_flag5=1 # Setting constrains on rotation over y- axis
715 disp_flag6=1 # Setting constrains on rotation over z-axis
716 disp_ux=1 # value of disp in x- direction
717 disp_uy=2
718 disp_uz=3
719 disp_rx=4 # value of rotation in y-direction
720 disp_ry=5
721 disp_rz=6
722
723 # Note above values could be interpreted differently if needed.
724
725 [block_1004]
726
727 # Example applying force boundary conditions
728
729 id=2004
730 add=NODESET
731 force_magnitude=1
732 moment_magnitude=1
733 force_fx=1
734 force_fy=1
735 force_fz=1
736 moment_mx=1
737 moment_my=1
738 moment_mz=1
739
740 [block_1005]
741
742 # Example applying pressure boundary conditions
743
744 id=2005
745 add=SIDESET
746 pressure_flag2=1 # 0: Pressure is interpreted as pure pressure 1:
747 pressure is interpreted as total force
748 pressure_magnitude=1
749
750 # Example applying temperature boundary conditions
751
752 [block_1006]
753
754 id=2006
755 add=NODESET
756 temperature_flag1=1 # 0: N/A, 1: temperature value applied
757 temperature_t=1
758
759 [block_1007]
760
761 id=2007
762 add=SIDESET
763 heatflux_flag1=1 # 0: N/A, 1: heat flux applied
764 heatflux_magnitude=1
765
766 [block_1008]
767
768 # Example applying material block (isotropic thermal material)
769
770 id=2008
771 add=BLOCKSET
772 name=MAT_THERMAL # Hast to be set for Thermal Mat
773 conductivity=1
774 capacity=1
775
776 [block_1009]
777
778 # Example applying interface
779 id=2009
780 add=SIDESET
781 interface_type=1
782
783 [block_1010]
784
785 # Example applying material block for interface element
786
787 id=2010
788 add=BLOCKSET
789 name=MAT_INTERF
790 interface_alpha = 1
791 interface_beta = 0
792 interface_ft = 1
793 interface_Gf = 1
794
795
796 [block_1009]
797
798 # Example applying material block (isotropic trans iso material)
799
800 id=2011
801 add=BLOCKSET
802 name=MAT_ELASTIC_TRANS_ISO
803 Youngp=1
804 Youngz=2
805 Poissonp=3
806 Poissonpz=4
807 Shearzp=5
808
809 [SET_ATTR_foo]
810
811 # Example set atttributes to block name "foo"
812 number_of_attributes=3
813 user1=1
814 user2=2
815 user3=3
816
817 \endcode
818
819 * @param file_name config file
820 * @return error code
821
822 */
823 MoFEMErrorCode setMeshsetFromFile(const string file_name,
824 const bool clean_file_options = true);
825
826 /**
827 * \brief get name of config file from line command '-meshsets_config'
828 * @return error code
829
830 Option is "-meshsets_config file_name.cfg"
831
832 */
834
835 /**
836 * @brief save cubit meshset entities on the moab mesh
837 *
838 * @param ms_id id of the cubit meshset (NODESET SIDESET BLOCKSET)
839 * @param cubit_bc_type type of a cubit mesheset
840 * @param file_name optional name for the file
841 * @param file_type optional file type for moab (VTK MOAB)
842 * @param options optional parameters for moab writer (PARALLEL=WRITE_PART)
843 * @return MoFEMErrorCode
844 */
846 saveMeshsetToFile(const int ms_id, const unsigned int cubit_bc_type,
847 const std::string file_name = "out_meshset.vtk",
848 const std::string file_type = "VTK",
849 const std::string options = "") const;
850
851 /**
852 * @brief save cubit meshset entities on the moab mesh
853 *
854 * @param ms_id id of the cubit meshset
855 * @param cubit_bc_type type of a cubit mesheset (NODESET SIDESET BLOCKSET)
856 * @param dim dimension of the entities
857 * @param file_name optional name for the file
858 * @param file_type optional file type for moab (VTK MOAB)
859 * @param options optional parameters for moab writer (PARALLEL=WRITE_PART)
860 * @return MoFEMErrorCode
861 */
863 const int ms_id, const unsigned int cubit_bc_type, const int dim,
864 const std::string file_name = "out_meshset.vtk",
865 const bool recursive = false, const std::string file_type = "VTK",
866 const std::string options = "") const;
867
868 /**
869 * \brief Get config file options, use with care
870 * @return error code
871 */
872 inline boost::shared_ptr<boost::program_options::options_description> &
876
877 /**
878 * @brief Update all blolsets, sidesets and node sets
879 *
880 * @param bit
881 * @return MoFEMErrorCode
882 */
884
885 static bool broadcastMeshsetsOn; ///< if true meshsets are synchronised
886 ///< between processors
887
888 static void sortMeshsets(std::vector<const CubitMeshSets *> &vec_ptr);
889
890protected:
897
898 // cubit
900 boost::shared_ptr<boost::program_options::options_description>
901 configFileOptionsPtr; ///< config file options
902
903};
904
905template <class CUBIT_BC_DATA_TYPE>
907 unsigned long int type) const {
909 const MoFEM::Interface &m_field = cOre;
910 const moab::Interface &moab = m_field.get_moab();
911 for (auto it : getCubitMeshsetPtr(type)) {
912 CHKERR it->getBcDataStructure(data);
913 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *it;
914 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << data;
915 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << "name " << it->getName();
916 for (EntityType t = MBVERTEX; t != MBENTITYSET; ++t) {
917 int nb;
918 CHKERR moab.get_number_entities_by_type(it->meshset, t, nb, true);
919 if (nb > 0) {
920 MOFEM_LOG("MeshsetMngSync", Sev::inform)
921 << "msId " << it->getMeshsetId() << " number of "
922 << moab::CN::EntityTypeName(t) << " " << nb;
923 }
924 }
925 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::inform);
926 }
928}
929
930} // namespace MoFEM
931
932#endif //__MESHSETSMANAGER_HPP__
933
934/**
935 * \defgroup mofem_meshset_mng MeshsetsManager
936 * \brief Interface for meshsets with entities with data and boundary conditions
937 *
938 * \ingroup mofem
939 **/
#define MOFEM_LOG_SEVERITY_SYNC(comm, severity)
Synchronise "SYNC" on curtain severity level.
@ DEFAULT_VERBOSITY
MoFEMTypes
Those types control how functions respond on arguments, f.e. error handling.
@ MF_EXIST
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MOFEM_LOG(channel, severity)
Log.
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.
std::bitset< 32 > CubitBCType
Definition Types.hpp:52
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition Types.hpp:40
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
CubitMeshSet_multiIndex::index< CubitMeshsetType_mi_tag >::type CubitMeshsetById
CubitMeshSet_multiIndex::index< CubitMeshsetMaskedType_mi_tag >::type CubitMeshsetByMask
CubitMeshSet_multiIndex::index< CubitMeshsets_name >::type CubitMeshsetByName
multi_index_container< CubitMeshSets, indexed_by< hashed_unique< tag< Meshset_mi_tag >, member< CubitMeshSets, EntityHandle, &CubitMeshSets::meshset > >, ordered_non_unique< tag< CubitMeshsetType_mi_tag >, const_mem_fun< CubitMeshSets, unsigned long int, &CubitMeshSets::getBcTypeULong > >, ordered_non_unique< tag< CubitMeshsetMaskedType_mi_tag >, const_mem_fun< CubitMeshSets, unsigned long int, &CubitMeshSets::getMaskedBcTypeULong > >, ordered_non_unique< tag< CubitMeshsets_name >, const_mem_fun< CubitMeshSets, std::string, &CubitMeshSets::getName > >, hashed_unique< tag< Composite_Cubit_msId_And_MeshsetType_mi_tag >, composite_key< CubitMeshSets, const_mem_fun< CubitMeshSets, int, &CubitMeshSets::getMeshsetId >, const_mem_fun< CubitMeshSets, unsigned long int, &CubitMeshSets::getMaskedBcTypeULong > > > > > CubitMeshSet_multiIndex
Stores data about meshsets (see CubitMeshSets) storing data about boundary conditions,...
CubitMeshSet_multiIndex::index< CubitMeshsetType_mi_tag >::type CubitMeshsetByType
constexpr double t
plate stiffness
Definition plate.cpp:58
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
Core (interface) class.
Definition Core.hpp: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)
Broadcast 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.
static void sortMeshsets(std::vector< const CubitMeshSets * > &vec_ptr)
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)
Read 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