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