v0.9.0
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 
22 namespace MoFEM {
23 
24 typedef CubitMeshSet_multiIndex::index<CubitMeshSets_mi_tag>::type
26 
27 typedef CubitMeshSet_multiIndex::index<CubitMeshSets_mask_meshset_mi_tag>::type
29 
30 typedef CubitMeshSet_multiIndex::index<CubitMeshSets_name>::type
32 
33 typedef CubitMeshSet_multiIndex::index<CubitMeshSets_mi_tag>::type
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
68 BC 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
77 for(_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
100 for(_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 
112 
113 /** \brief Interface for managing meshsets containing materials and boundary
114  * conditions
115  * \ingroup mofem_meshset_mng
116  */
118 
120  UnknownInterface **iface) const;
121 
123  MeshsetsManager(const MoFEM::Core &core);
125 
126  /**
127  * \brief get tags handlers used on meshsets
128 
129  * On meshsets range of tags in set. Depending on tag type and data on that
130  * tag type of meshset could be determined. This function get hanldes to
131  * tags.
132  *
133  * Most of the tags are followinf convention used by MoAB or Cubit and other
134  * meshing softwares, f.e. gmesh.
135 
136  */
137  MoFEMErrorCode getTags(int verb = -1);
138 
139  /**
140  * \brief get tag handle used to store "id" of NODESET
141  */
142  inline Tag get_nsTag() const { return nsTag; }
143 
144  /**
145  * \brief get tag handle used to store "id" of SIDESET
146  */
147  inline Tag get_ssTag() const { return ssTag; }
148 
149  /**
150  * \brief get tag handle used to store boundary data on NODESET
151  */
152  inline Tag get_nsTag_data() const { return nsTag_data; }
153 
154  /**
155  * \brief get tag handle used to store boundary data on SIDESET
156  */
157  inline Tag get_ssTag_data() const { return ssTag_data; }
158 
159  /**
160  * \brief get tag handle used to store "id" of BLOCKSET
161  */
162  inline Tag get_bhTag() const { return bhTag; }
163 
164  /**
165  * \brief get tag handle used to store of block set header (Used by Cubit)
166  */
167  inline Tag get_bhTag_header() const { return bhTag_header; }
168 
169  /**
170  * \brief return pointer to meshset manager
171  */
173 
174  /**
175  * \brief return pointer to meshset manager
176  */
177  const MeshsetsManager *get_meshsets_manager_ptr() const { return this; }
178 
179  /**
180  * \brief clear multi-index container
181  * @return error code
182  */
184 
185  /**
186  * \brier initialize container form data on mesh
187  * @return [description]
188  */
190 
191  template <class CUBIT_BC_DATA_TYPE>
192  MoFEMErrorCode printBcSet(CUBIT_BC_DATA_TYPE &data,
193  unsigned long int type) const;
194 
195  /**
196  * \brief print meshsets with displacement boundary conditions data
197  * structure
198  */
200 
201  /**
202  * \brief print meshsets with pressure boundary conditions data structure
203  */
205 
206  /**
207  * \brief print meshsets with force boundary conditions data structure
208  */
210 
211  /**
212  * \brief print meshsets with temperature boundary conditions data structure
213  */
215 
216  /**
217  * \brief print meshsets with heat flux boundary conditions data structure
218  */
220 
221  /**
222  * \brief print meshsets with material data structure set on it
223  */
225 
227  return cubitMeshsets;
228  }
229 
230  /**
231  * \ingroup mofem_meshset_mng
232  * \brief get begin iterator of cubit mehset of given type (instead you can
233  * use _IT_CUBITMESHSETS_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
234  *
235  * for(_IT_CUBITMESHSETS_FOR_LOOP_(mField,it) {
236  * ...
237  * }
238  *
239  */
240  inline CubitMeshSet_multiIndex::iterator getBegin() const {
241  return cubitMeshsets.begin();
242  }
243 
244  /**
245  * \ingroup mofem_meshset_mng
246  * \brief get begin iterator of cubit mehset of given type (instead you can
247  * use _IT_CUBITMESHSETS_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
248  *
249  * for(_IT_CUBITMESHSETS_FOR_LOOP_(mField,it) {
250  * ...
251  * }
252  *
253  */
254  CubitMeshSet_multiIndex::iterator getEnd() const {
255  return cubitMeshsets.end();
256  }
257 
258  /**
259  * \brief get begin iterator of cubit mehset of given type (instead you can
260  use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
261  * \ingroup mofem_meshset_mng
262 
263  *
264  *
265  for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
266  {
267  * ...
268  * }
269  *
270  * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
271  */
272  inline CubitMeshsetByType::iterator
273  getBegin(const unsigned int cubit_bc_type) const {
274  return cubitMeshsets.get<CubitMeshSets_mi_tag>().lower_bound(cubit_bc_type);
275  }
276 
277  /**
278  * \brief get begin iterator of cubit mehset of given type (instead you can
279  use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
280  * \ingroup mofem_meshset_mng
281 
282  *
283  *
284  for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
285  {
286  * ...
287  * }
288  *
289  * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
290  */
291  inline CubitMeshsetByType::iterator
292  getEnd(const unsigned int cubit_bc_type) const {
293  return cubitMeshsets.get<CubitMeshSets_mi_tag>().upper_bound(cubit_bc_type);
294  }
295 
296  /**
297  * \brief get end iterator of cubit meshset of given type (instead you can
298  use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
299  * \ingroup mofem_meshset_mng
300 
301  *
302  * for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET,it) {
303  * ...
304  * }
305  *
306  * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
307  */
308  inline CubitMeshsetByMask::iterator
309  getBySetTypeBegin(const unsigned int cubit_bc_type) const {
310  return cubitMeshsets.get<CubitMeshSets_mask_meshset_mi_tag>().lower_bound(
311  cubit_bc_type);
312  }
313 
314  /**
315  * \brief get end iterator of cubit mehset of given type (instead you can
316  use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
317  * \ingroup mofem_meshset_mng
318 
319  *
320  * for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET,it) {
321  * ...
322  * }
323  *
324  * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
325  */
326  inline CubitMeshsetByMask::iterator
327  getBySetTypeEnd(const unsigned int cubit_bc_type) const {
328  return cubitMeshsets.get<CubitMeshSets_mask_meshset_mi_tag>().upper_bound(
329  cubit_bc_type);
330  }
331 
332  /**
333  * \brief get begin iterator of cubit mehset of given type (instead you can
334  use _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
335  * \ingroup mofem_meshset_mng
336 
337  *
338  *
339  for(_IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
340  {
341  * ...
342  * }
343  *
344  * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
345  */
346  inline CubitMeshsetByName::iterator getBegin(const std::string &name) const {
347  return cubitMeshsets.get<CubitMeshSets_name>().lower_bound(name);
348  }
349 
350  /**
351  * \brief get begin iterator of cubit mehset of given type (instead you can
352  use _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
353  * \ingroup mofem_meshset_mng
354 
355  *
356  *
357  for(_IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
358  {
359  * ...
360  * }
361  *
362  * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
363  */
364  inline CubitMeshsetByName::iterator getEnd(const std::string &name) const {
365  return cubitMeshsets.get<CubitMeshSets_name>().upper_bound(name);
366  }
367 
368  /**
369  * \brief check for CUBIT Id and CUBIT type
370  * \ingroup mofem_meshset_mng
371 
372  \todo All cubit interface functions should be outsourced to dedicated
373  interface
374 
375  * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
376  * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
377  */
378  bool checkMeshset(const int ms_id, const CubitBCType cubit_bc_type) const;
379 
380  /**
381  * \brief check if meshset of given name exist
382  * @param name name of meshset
383  * @return error code
384  */
385  bool checkMeshset(const string name,
386  int *const number_of_meshsets_ptr = NULL) const;
387 
388  /**
389  * \brief add cubit meshset
390  * \ingroup mofem_meshset_mng
391 
392  *
393  * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
394  * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET
395  * \param name of set
396 
397  */
398  MoFEMErrorCode addMeshset(const CubitBCType cubit_bc_type, const int ms_id,
399  const std::string name = "");
400 
401  /**
402  * \brief add entities to cubit meshset
403  * @param cubit_bc_type type of meshset, f.e. NODESET, SIDESET or BLOCKSET
404  * @param ms_id id of meshset
405  * @param ents entities to add
406  * @return error code
407  */
408  MoFEMErrorCode addEntitiesToMeshset(const CubitBCType cubit_bc_type,
409  const int ms_id, const Range &ents);
410 
411  /**
412  * \brief add entities to cubit meshset
413  * @param cubit_bc_type type of meshset, f.e. NODESET, SIDESET or BLOCKSET
414  * @param ms_id id of meshset
415  * @param ents pointer to entities array
416  * @param nb_ents number of entities in array
417  * @return error code
418  */
419  MoFEMErrorCode addEntitiesToMeshset(const CubitBCType cubit_bc_type,
420  const int ms_id, const EntityHandle *ents,
421  const int nb_ents);
422 
423  /**
424  * \brief set attributes to cubit meshset
425  * @param cubit_bc_type type of meshset, see CubitBC, i.e. BLOCKSET,
426  * NODESET, SIDESET
427  * @param ms_id id of meshset
428  * @param attributes attributes
429  * @return error code
430  */
431  MoFEMErrorCode setAtributes(const CubitBCType cubit_bc_type, const int ms_id,
432  const std::vector<double> &attributes,
433  const std::string name = "");
434 
435  /**
436  * \brief set (material) data structure to cubit meshset
437  * @param cubit_bc_type type of meshset, see CubitBC, i.e. BLOCKSET,
438  * NODESET, SIDESET
439  * @param ms_id id of meshset
440  * @param attributes attributes
441  * @return error code
442  */
444  const int ms_id,
445  const GenericAttributeData &data,
446  const std::string name = "");
447 
448  /**
449  * \brief set boundary data structure to meshset
450  * @param cubit_bc_type type of meshset, see CubitBC, i.e. BLOCKSET,
451  * NODESET, SIDESET
452  * @param ms_id id of meshset
453  * @param data data structure
454  * @return error code
455  */
456  MoFEMErrorCode setBcData(const CubitBCType cubit_bc_type, const int ms_id,
457  const GenericCubitBcData &data);
458 
459  /**
460  * \brief delete cubit meshset
461  * \ingroup mopfem_bc
462 
463  *
464  * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
465  * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
466  *
467  */
468  MoFEMErrorCode deleteMeshset(const CubitBCType cubit_bc_type, const int ms_id,
469  const MoFEMTypes bh = MF_EXIST);
470 
471  /**
472  * \brief get cubit meshset
473  * \ingroup mofem_meshset_mng
474 
475  */
477  getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type,
478  const CubitMeshSets **cubit_meshset_ptr) const;
479 
480  /**
481  * \brief get cubit meshset
482  * \ingroup mofem_meshset_mng
483 
484  */
486  getCubitMeshsetPtr(const string name,
487  const CubitMeshSets **cubit_meshset_ptr) const;
488 
489  /**
490  * \brief get entities from CUBIT/meshset of a particular entity dimension
491  * \ingroup mofem_meshset_mng
492 
493  * Nodeset can contain nodes, edges, triangles and tets. This applies to
494  other meshsets too.
495  * The nodeset's meshset contain the nodes in the MIDDLE of the surface or
496  volume which is done by default in Cubit,
497  * Hence if all nodes on a particular nodeset are required,
498  * one should get all triangles or tetrahedrons for which the nodeset was
499  create in Cubit,
500  * and get all the connectivities of tris/tets.
501 
502  * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
503  * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
504  * \param dimensions (0 - Nodes, 1 - Edges, 2 - Faces, 3 -
505  Volume(tetrahedral))
506  * \param Range containing the retrieved entities
507  * \param recursive If true, meshsets containing meshsets are queried
508  recursively. Returns the contents of meshsets, but not the meshsets
509  themselves if true.
510  */
511  MoFEMErrorCode getEntitiesByDimension(const int ms_id,
512  const unsigned int cubit_bc_type,
513  const int dimension, Range &entities,
514  const bool recursive = true) const;
515 
516  /**
517  * \brief get entities related to CUBIT/meshset,
518  * \ingroup mofem_meshset_mng
519 
520  * NODESET will get Vertices only, even if the NODESET contains edges, tris
521  and tets
522  * SIDESET will get Tris, BLOCKSET will get Tets, DISPLACEMENTSET and
523  FORCESET are stored in NODESET, PRESSURESET is stored in Sideset.
524 
525  * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
526  * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
527  * \param Range containing the retrieved entities related to the
528  * \param recursive If true, meshsets containing meshsets are queried
529  recursively. Returns the contents of meshsets, but not the meshsets
530  themselves if true.
531  */
532  MoFEMErrorCode getEntitiesByDimension(const int ms_id,
533  const unsigned int cubit_bc_type,
534  Range &entities,
535  const bool recursive = true) const;
536 
537  /**
538  * \ingroup mofem_meshset_mng
539  * \brief get meshset from CUBIT Id and CUBIT type
540  *
541  * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
542  * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
543  * \param meshset where to store the retrieved entities
544  */
545  MoFEMErrorCode getMeshset(const int ms_id, const unsigned int cubit_bc_type,
546  EntityHandle &meshset) const;
547 
548  /**
549  * @brief Check if meshset constains entities
550  *
551  * @param ms_id
552  * @param cubit_bc_type
553  * @param entities
554  * @param num_entities
555  * @param operation_type
556  * @return true
557  * @return false
558  */
560  const int ms_id, const unsigned int cubit_bc_type,
561  const EntityHandle *entities, int num_entities,
562  const int operation_type = moab::Interface::INTERSECT);
563 
564  /**
565  * \ingroup mofem_meshset_mng
566  * \brief get all CUBIT meshsets by CUBIT type
567  *
568  * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more).
569  * \param meshsets is range of meshsets
570  */
571  MoFEMErrorCode getMeshsetsByType(const unsigned int cubit_bc_type,
572  Range &meshsets) const;
573 
574  /**
575  * \brief add blocksets reading config file
576 
577  Example of config file
578  \code
579 
580  [block_1001]
581 
582  # Example applying attributes to blockset
583 
584  id=2001
585  add=BLOCKSET
586  user1=1.0 # attribute value 1
587  user2=2.0 # you can set up to 10 attributes (if needed could be easily
588  extended to more, let us know)
589  user3=3.0
590 
591  [block_1002]
592 
593  # Example applying material block (isotropic elastic material)
594 
595  id=2002
596  add=BLOCKSET
597  name=MAT_ELASTIC
598  young=10
599  poisson=0.25
600  thermalexpansion=0
601 
602  [block_1003]
603 
604  # Example applying displacement constrains
605 
606  id=2003
607  add=NODESET
608 
609  # Each flag means that boundary consition on displacements is set.
610  disp_flag1=1 # Setting constrains in x- direction
611  disp_flag2=1 # Setting constrains in y- direction
612  disp_flag3=1 # Setting constrains in z- direction
613  disp_flag4=1 # Setting constrains on rotation over x- axis
614  disp_flag5=1 # Setting constrains on rotation over y- axis
615  disp_flag6=1 # Setting constrains on rotation over z-axis
616  disp_ux=1 # value of disp in x- direction
617  disp_uy=2
618  disp_uz=3
619  disp_rx=4 # value of rotation in y-direction
620  disp_ry=5
621  disp_rz=6
622 
623  # Note above values could be interpreted differently if needed.
624 
625  [block_1004]
626 
627  # Example applying force boundary conditions
628 
629  id=2004
630  add=NODESET
631  force_magnitude=1
632  moment_magnitude=1
633  force_fx=1
634  force_fy=1
635  force_fz=1
636  moment_mx=1
637  moment_my=1
638  moment_mz=1
639 
640  [block_1005]
641 
642  # Example applying pressure boundary conditions
643 
644  id=2005
645  add=SIDESET
646  pressure_flag2=1 # 0: Pressure is interpreted as pure pressure 1:
647  pressure is interpreted as total force
648  pressure_magnitude=1
649 
650  # Example applying temperature boundary conditions
651 
652  [block_1006]
653 
654  id=2006
655  add=NODESET
656  temperature_flag1=1 # 0: N/A, 1: temperature value applied
657  temperature_t=1
658 
659  [block_1007]
660 
661  id=2007
662  add=SIDESET
663  heatflux_flag1=1 # 0: N/A, 1: heat flux applied
664  heatflux_magnitude=1
665 
666  [block_1008]
667 
668  # Example applying material block (isotropic thermal material)
669 
670  id=2008
671  add=BLOCKSET
672  name=MAT_THERMAL # Hast to be set for Thermal Mat
673  conductivity=1
674  capacity=1
675 
676  [block_1009]
677 
678  # Example applying interface
679  id=2009
680  add=SIDESET
681  interface_type=1
682 
683  [block_1010]
684 
685  # Example applying material block for interface element
686 
687  id=2010
688  add=BLOCKSET
689  name=MAT_INTERF
690  interface_alpha = 1
691  interface_beta = 0
692  interface_ft = 1
693  interface_Gf = 1
694 
695  \endcode
696 
697  * @param file_name config file
698  * @return error code
699 
700  */
701  MoFEMErrorCode setMeshsetFromFile(const string file_name,
702  const bool clean_file_options = true);
703 
704  /**
705  * \brief get name of config file from line command '-meshsets_config'
706  * @return error code
707 
708  Option is "-meshsets_config file_name.cfg"
709 
710  */
712 
713  /**
714  * @brief save cubit meshset entities on the moab mesh
715  *
716  * @param ms_id id of the cubit meshset (NODESET SIDESET BLOCKSET)
717  * @param cubit_bc_type type of a cubit mesheset
718  * @param file_name optional name for the file
719  * @param file_type optional file type for moab (VTK MOAB)
720  * @param options optional parameters for moab writer (PARALLEL=WRITE_PART)
721  * @return MoFEMErrorCode
722  */
724  saveMeshsetToFile(const int ms_id, const unsigned int cubit_bc_type,
725  const std::string file_name = "out_meshset.vtk",
726  const std::string file_type = "VTK",
727  const std::string options = "") const;
728 
729  /**
730  * @brief save cubit meshset entities on the moab mesh
731  *
732  * @param ms_id id of the cubit meshset
733  * @param cubit_bc_type type of a cubit mesheset (NODESET SIDESET BLOCKSET)
734  * @param dim dimension of the entities
735  * @param file_name optional name for the file
736  * @param file_type optional file type for moab (VTK MOAB)
737  * @param options optional parameters for moab writer (PARALLEL=WRITE_PART)
738  * @return MoFEMErrorCode
739  */
741  const int ms_id, const unsigned int cubit_bc_type, const int dim,
742  const std::string file_name = "out_meshset.vtk",
743  const bool recursive = false, const std::string file_type = "VTK",
744  const std::string options = "") const;
745 
746  /**
747  * \brief Get config file options, use with care
748  * @return error code
749  */
750  inline boost::shared_ptr<boost::program_options::options_description> &
752  return configFileOptionsPtr;
753  }
754 
756 
757 protected:
758  Tag nsTag;
759  Tag ssTag;
762  Tag bhTag;
764 
765  // cubit
767  boost::shared_ptr<boost::program_options::options_description>
768  configFileOptionsPtr; ///< config file options
769 };
770 
771 template <class CUBIT_BC_DATA_TYPE>
773  unsigned long int type) const {
775  const MoFEM::Interface &m_field = cOre;
776  const moab::Interface &moab = m_field.get_moab();
777  for (_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_((*this), type, it)) {
778  CHKERR it->getBcDataStructure(data);
779  std::ostringstream ss;
780  ss << *it << std::endl;
781  ss << data << std::endl;
782  int tets, tris, edges, nodes, prisms, quads;
783  CHKERR moab.get_number_entities_by_type(it->meshset, MBTET, tets, true);
784  CHKERR moab.get_number_entities_by_type(it->meshset, MBTRI, tris, true);
785  CHKERR moab.get_number_entities_by_type(it->meshset, MBEDGE, edges, true);
786  CHKERR moab.get_number_entities_by_type(it->meshset, MBVERTEX, nodes, true);
787  CHKERR moab.get_number_entities_by_type(it->meshset, MBPRISM, prisms, true);
788  CHKERR moab.get_number_entities_by_type(it->meshset, MBQUAD, quads, true);
789  ss << "name " << it->getName() << std::endl;
790  ss << "msId " << it->getMeshsetId() << " nb. tets " << tets << std::endl;
791  ss << "msId " << it->getMeshsetId() << " nb. prisms " << prisms << std::endl;
792  ss << "msId " << it->getMeshsetId() << " nb. quads " << quads << std::endl;
793  ss << "msId " << it->getMeshsetId() << " nb. tris " << tris << std::endl;
794  ss << "msId " << it->getMeshsetId() << " nb. edges " << edges << std::endl;
795  ss << "msId " << it->getMeshsetId() << " nb. nodes " << nodes << std::endl;
796  ss << std::endl;
797  PetscPrintf(m_field.get_comm(), ss.str().c_str());
798  }
800 }
801 
802 } // namespace MoFEM
803 
804 #endif //__MESHSETSMANAGER_HPP__
805 
806 /**
807  * \defgroup mofem_meshset_mng MeshsetsManager
808  * \brief Interface for meshsets with entities with data and boundary conditions
809  *
810  * \ingroup mofem
811  **/
Generic bc data structure.
Definition: BCData.hpp:30
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 getMeshset(const int ms_id, const unsigned int cubit_bc_type, EntityHandle &meshset) const
get meshset from CUBIT Id and CUBIT type
MoFEM interface unique ID.
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, UnknownInterface **iface) const
CubitMeshSet_multiIndex cubitMeshsets
cubit meshsets
static const MOFEMuuid IDD_MOFEMMeshsetsManager
Tag get_ssTag() const
get tag handle used to store "id" of SIDESET
virtual moab::Interface & get_moab()=0
CubitMeshSet_multiIndex::iterator getEnd() const
get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_TYPE_FOR_LOOP(...
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_...
boost::shared_ptr< boost::program_options::options_description > configFileOptionsPtr
config file options
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 updateAllMeshsetsByEntitiesChildren(const BitRefLevel &bit)
CubitMeshSet_multiIndex::index< CubitMeshSets_mask_meshset_mi_tag >::type CubitMeshsetByMask
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 dimensionNodeset can contain nodes,...
base class for all interface classes
Tag get_nsTag_data() const
get tag handle used to store boundary data on NODESET
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
this struct keeps basic methods for moab meshset about material and boundary conditions
MoFEMErrorCode printHeatFluxSet() const
print meshsets with heat flux boundary conditions data structure
Interface for managing meshsets containing materials and boundary conditions.
Core (interface) class.
Definition: Core.hpp:50
CubitMeshSet_multiIndex & getMeshsetsMultindex()
std::bitset< BITINTERFACEUID_SIZE > BitIntefaceId
Definition: Types.hpp:56
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:21
MoFEMErrorCode deleteMeshset(const CubitBCType cubit_bc_type, const int ms_id, const MoFEMTypes bh=MF_EXIST)
delete cubit meshset
MoFEMErrorCode getTags(int verb=-1)
get tags handlers used on meshsets
MoFEMErrorCode setMeshsetFromFile()
get name of config file from line command '-meshsets_config'
multi_index_container< CubitMeshSets, indexed_by< hashed_unique< tag< Meshset_mi_tag >, member< CubitMeshSets, EntityHandle, &CubitMeshSets::meshset > >, ordered_non_unique< tag< CubitMeshSets_mi_tag >, const_mem_fun< CubitMeshSets, unsigned long int, &CubitMeshSets::getBcTypeULong > >, ordered_non_unique< tag< CubitMeshSets_mask_meshset_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< CubitMeshSets_mi_tag >::type CubitMeshsetById
MoFEMErrorCode printBcSet(CUBIT_BC_DATA_TYPE &data, unsigned long int type) const
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=0)
MoFEMErrorCode printTemperatureSet() const
print meshsets with temperature boundary conditions data structure
MoFEMErrorCode setBcData(const CubitBCType cubit_bc_type, const int ms_id, const GenericCubitBcData &data)
set boundary data structure to meshset
CubitMeshSet_multiIndex::iterator getBegin() const
get begin iterator of cubit mehset of given type (instead you can use IT_CUBITMESHSETS_TYPE_FOR_LOOP(...
MoFEMErrorCode addMeshset(const CubitBCType cubit_bc_type, const int ms_id, const std::string name="")
add cubit meshset
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...
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...
MoFEMErrorCode printForceSet() const
print meshsets with force boundary conditions data structure
MeshsetsManager * get_meshsets_manager_ptr()
return pointer to meshset manager
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:66
#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet in a moFEM field.
bool checkMeshset(const int ms_id, const CubitBCType cubit_bc_type) const
check for CUBIT Id and CUBIT type
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 printPressureSet() const
print meshsets with pressure boundary conditions data structure
MoFEMErrorCode printDisplacementSet() const
print meshsets with displacement boundary conditions data structure
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 addEntitiesToMeshset(const CubitBCType cubit_bc_type, const int ms_id, const Range &ents)
add entities to cubit meshset
MeshsetsManager(const MoFEM::Core &core)
MoFEMErrorCode printMaterialsSet() const
print meshsets with material data structure set on it
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...
MultiIndex Tag for field id.
Generic attribute data structure.
#define CHKERR
Inline error check.
Definition: definitions.h:596
MoFEMErrorCode getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr) const
get cubit meshset
const MeshsetsManager * get_meshsets_manager_ptr() const
return pointer to meshset manager
Tag get_bhTag_header() const
get tag handle used to store of block set header (Used by Cubit)
boost::shared_ptr< boost::program_options::options_description > & getConfigFileOptionsPtr()
Get config file options, use with care.
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:51
CubitMeshSet_multiIndex::index< CubitMeshSets_mi_tag >::type CubitMeshsetByType
CubitMeshSet_multiIndex::index< CubitMeshSets_name >::type CubitMeshsetByName
MoFEMErrorCode getMeshsetsByType(const unsigned int cubit_bc_type, Range &meshsets) const
get all CUBIT meshsets by CUBIT type
std::bitset< 32 > CubitBCType
Definition: Types.hpp:63
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407
virtual MPI_Comm & get_comm() const =0
Tag get_ssTag_data() const
get tag handle used to store boundary data on SIDESET
MoFEMErrorCode clearMap()
clear multi-index container
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() const
get tag handle used to store "id" of BLOCKSET
MoFEMTypes
Those types control how functions respond on arguments, f.e. error handling.
Definition: definitions.h:183
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...
Tag get_nsTag() const
get tag handle used to store "id" of NODESET