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