v0.8.23
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 
196  const MoFEM::Interface &m_field = cOre;
197  const moab::Interface &moab = m_field.get_moab();
198  for (_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_((*this), type, it)) {
199  CHKERR it->getBcDataStructure(data);
200  std::ostringstream ss;
201  ss << *it << std::endl;
202  ss << data << std::endl;
203  Range tets, tris, edges, nodes;
204  CHKERR moab.get_entities_by_type(it->meshset, MBTET, tets, true);
205  CHKERR moab.get_entities_by_type(it->meshset, MBTRI, tris, true);
206  CHKERR moab.get_entities_by_type(it->meshset, MBEDGE, edges, true);
207  CHKERR moab.get_entities_by_type(it->meshset, MBVERTEX, nodes, true);
208  ss << "name " << it->getName() << std::endl;
209  ss << "msId " << it->getMeshsetId() << " nb. tets " << tets.size()
210  << std::endl;
211  ss << "msId " << it->getMeshsetId() << " nb. tris " << tris.size()
212  << std::endl;
213  ss << "msId " << it->getMeshsetId() << " nb. edges " << edges.size()
214  << std::endl;
215  ss << "msId " << it->getMeshsetId() << " nb. nodes " << nodes.size()
216  << std::endl;
217  ss << std::endl;
218  PetscPrintf(m_field.get_comm(), ss.str().c_str());
219  }
221  }
222 
223  /**
224  * \brief print meshsets with displacement boundary conditions data
225  * structure
226  */
228 
229  /**
230  * \brief print meshsets with pressure boundary conditions data structure
231  */
233 
234  /**
235  * \brief print meshsets with force boundary conditions data structure
236  */
238 
239  /**
240  * \brief print meshsets with temperature boundary conditions data structure
241  */
243 
244  /**
245  * \brief print meshsets with heat flux boundary conditions data structure
246  */
248 
249  /**
250  * \brief print meshsets with material data structure set on it
251  */
253 
255  return cubitMeshsets;
256  }
257 
258  /**
259  * \ingroup mofem_meshset_mng
260  * \brief get begin iterator of cubit mehset of given type (instead you can
261  * use _IT_CUBITMESHSETS_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
262  *
263  * for(_IT_CUBITMESHSETS_FOR_LOOP_(mField,it) {
264  * ...
265  * }
266  *
267  */
268  inline CubitMeshSet_multiIndex::iterator getBegin() const {
269  return cubitMeshsets.begin();
270  }
271 
272  /**
273  * \ingroup mofem_meshset_mng
274  * \brief get begin iterator of cubit mehset of given type (instead you can
275  * use _IT_CUBITMESHSETS_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
276  *
277  * for(_IT_CUBITMESHSETS_FOR_LOOP_(mField,it) {
278  * ...
279  * }
280  *
281  */
282  CubitMeshSet_multiIndex::iterator getEnd() const {
283  return cubitMeshsets.end();
284  }
285 
286  /**
287  * \brief get begin iterator of cubit mehset of given type (instead you can
288  use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
289  * \ingroup mofem_meshset_mng
290 
291  *
292  *
293  for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
294  {
295  * ...
296  * }
297  *
298  * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
299  */
300  inline CubitMeshsetByType::iterator
301  getBegin(const unsigned int cubit_bc_type) const {
302  return cubitMeshsets.get<CubitMeshSets_mi_tag>().lower_bound(cubit_bc_type);
303  }
304 
305  /**
306  * \brief get begin iterator of cubit mehset of given type (instead you can
307  use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
308  * \ingroup mofem_meshset_mng
309 
310  *
311  *
312  for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
313  {
314  * ...
315  * }
316  *
317  * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
318  */
319  inline CubitMeshsetByType::iterator
320  getEnd(const unsigned int cubit_bc_type) const {
321  return cubitMeshsets.get<CubitMeshSets_mi_tag>().upper_bound(cubit_bc_type);
322  }
323 
324  /**
325  * \brief get end iterator of cubit meshset 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  getBySetTypeBegin(const unsigned int cubit_bc_type) const {
338  return cubitMeshsets.get<CubitMeshSets_mask_meshset_mi_tag>().lower_bound(
339  cubit_bc_type);
340  }
341 
342  /**
343  * \brief get end iterator of cubit mehset of given type (instead you can
344  use _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
345  * \ingroup mofem_meshset_mng
346 
347  *
348  * for(_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(mField,NODESET,it) {
349  * ...
350  * }
351  *
352  * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
353  */
354  inline CubitMeshsetByMask::iterator
355  getBySetTypeEnd(const unsigned int cubit_bc_type) const {
356  return cubitMeshsets.get<CubitMeshSets_mask_meshset_mi_tag>().upper_bound(
357  cubit_bc_type);
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 getBegin(const std::string &name) const {
375  return cubitMeshsets.get<CubitMeshSets_name>().lower_bound(name);
376  }
377 
378  /**
379  * \brief get begin iterator of cubit mehset of given type (instead you can
380  use _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MFIELD,CUBITBCTYPE,IT)
381  * \ingroup mofem_meshset_mng
382 
383  *
384  *
385  for(_IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(mField,NODESET|DISPLACEMENTSET,it)
386  {
387  * ...
388  * }
389  *
390  * \param type of meshset (NODESET, SIDESET or BLOCKSET and more)
391  */
392  inline CubitMeshsetByName::iterator getEnd(const std::string &name) const {
393  return cubitMeshsets.get<CubitMeshSets_name>().upper_bound(name);
394  }
395 
396  /**
397  * \brief check for CUBIT Id and CUBIT type
398  * \ingroup mofem_meshset_mng
399 
400  \todo All cubit interface functions should be outsourced to dedicated
401  interface
402 
403  * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
404  * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
405  */
406  bool checkMeshset(const int ms_id, const CubitBCType cubit_bc_type) const;
407 
408  /**
409  * \brief check if meshset of given name exist
410  * @param name name of meshset
411  * @return error code
412  */
413  bool checkMeshset(const string name,
414  int *const number_of_meshsets_ptr = NULL) const;
415 
416  /**
417  * \brief add cubit meshset
418  * \ingroup mofem_meshset_mng
419 
420  *
421  * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
422  * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET
423  * \param name of set
424 
425  */
426  MoFEMErrorCode addMeshset(const CubitBCType cubit_bc_type, const int ms_id,
427  const std::string name = "");
428 
429  /**
430  * \brief add entities to cubit meshset
431  * @param cubit_bc_type type of meshset, f.e. NODESET, SIDESET or BLOCKSET
432  * @param ms_id id of meshset
433  * @param ents entities to add
434  * @return error code
435  */
436  MoFEMErrorCode addEntitiesToMeshset(const CubitBCType cubit_bc_type,
437  const int ms_id, const Range &ents);
438 
439  /**
440  * \brief add entities to cubit meshset
441  * @param cubit_bc_type type of meshset, f.e. NODESET, SIDESET or BLOCKSET
442  * @param ms_id id of meshset
443  * @param ents pointer to entities array
444  * @param nb_ents number of entities in array
445  * @return error code
446  */
447  MoFEMErrorCode addEntitiesToMeshset(const CubitBCType cubit_bc_type,
448  const int ms_id, const EntityHandle *ents,
449  const int nb_ents);
450 
451  /**
452  * \brief set attributes to cubit meshset
453  * @param cubit_bc_type type of meshset, see CubitBC, i.e. BLOCKSET,
454  * NODESET, SIDESET
455  * @param ms_id id of meshset
456  * @param attributes attributes
457  * @return error code
458  */
459  MoFEMErrorCode setAtributes(const CubitBCType cubit_bc_type, const int ms_id,
460  const std::vector<double> &attributes,
461  const std::string name = "");
462 
463  /**
464  * \brief set (material) data structure to cubit meshset
465  * @param cubit_bc_type type of meshset, see CubitBC, i.e. BLOCKSET,
466  * NODESET, SIDESET
467  * @param ms_id id of meshset
468  * @param attributes attributes
469  * @return error code
470  */
472  const int ms_id,
473  const GenericAttributeData &data,
474  const std::string name = "");
475 
476  /**
477  * \brief set boundary data structure to meshset
478  * @param cubit_bc_type type of meshset, see CubitBC, i.e. BLOCKSET,
479  * NODESET, SIDESET
480  * @param ms_id id of meshset
481  * @param data data structure
482  * @return error code
483  */
484  MoFEMErrorCode setBcData(const CubitBCType cubit_bc_type, const int ms_id,
485  const GenericCubitBcData &data);
486 
487  /**
488  * \brief delete cubit meshset
489  * \ingroup mopfem_bc
490 
491  *
492  * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
493  * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
494  *
495  */
496  MoFEMErrorCode deleteMeshset(const CubitBCType cubit_bc_type, const int ms_id,
497  const MoFEMTypes bh = MF_EXIST);
498 
499  /**
500  * \brief get cubit meshset
501  * \ingroup mofem_meshset_mng
502 
503  */
505  getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type,
506  const CubitMeshSets **cubit_meshset_ptr) const;
507 
508  /**
509  * \brief get cubit meshset
510  * \ingroup mofem_meshset_mng
511 
512  */
514  getCubitMeshsetPtr(const string name,
515  const CubitMeshSets **cubit_meshset_ptr) const;
516 
517  /**
518  * \brief get entities from CUBIT/meshset of a particular entity dimension
519  * \ingroup mofem_meshset_mng
520 
521  * Nodeset can contain nodes, edges, triangles and tets. This applies to
522  other meshsets too.
523  * The nodeset's meshset contain the nodes in the MIDDLE of the surface or
524  volume which is done by default in Cubit,
525  * Hence if all nodes on a particular nodeset are required,
526  * one should get all triangles or tetrahedrons for which the nodeset was
527  create in Cubit,
528  * and get all the connectivities of tris/tets.
529 
530  * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
531  * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
532  * \param dimensions (0 - Nodes, 1 - Edges, 2 - Faces, 3 -
533  Volume(tetrahedral))
534  * \param Range containing the retrieved entities
535  * \param recursive If true, meshsets containing meshsets are queried
536  recursively. Returns the contents of meshsets, but not the meshsets
537  themselves if true.
538  */
539  MoFEMErrorCode getEntitiesByDimension(const int ms_id,
540  const unsigned int cubit_bc_type,
541  const int dimension, Range &entities,
542  const bool recursive = true) const;
543 
544  /**
545  * \brief get entities related to CUBIT/meshset,
546  * \ingroup mofem_meshset_mng
547 
548  * NODESET will get Vertices only, even if the NODESET contains edges, tris
549  and tets
550  * SIDESET will get Tris, BLOCKSET will get Tets, DISPLACEMENTSET and
551  FORCESET are stored in NODESET, PRESSURESET is stored in Sideset.
552 
553  * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
554  * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
555  * \param Range containing the retrieved entities related to the
556  * \param recursive If true, meshsets containing meshsets are queried
557  recursively. Returns the contents of meshsets, but not the meshsets
558  themselves if true.
559  */
560  MoFEMErrorCode getEntitiesByDimension(const int ms_id,
561  const unsigned int cubit_bc_type,
562  Range &entities,
563  const bool recursive = true) const;
564 
565  /**
566  * \ingroup mofem_meshset_mng
567  * \brief get meshset from CUBIT Id and CUBIT type
568  *
569  * \param ms_id id of the BLOCKSET/SIDESET/BLOCKSET: from CUBIT
570  * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more)
571  * \param meshset where to store the retrieved entities
572  */
573  MoFEMErrorCode getMeshset(const int ms_id, const unsigned int cubit_bc_type,
574  EntityHandle &meshset) const;
575 
576  /**
577  * @brief Check if meshset constains entities
578  *
579  * @param ms_id
580  * @param cubit_bc_type
581  * @param entities
582  * @param num_entities
583  * @param operation_type
584  * @return true
585  * @return false
586  */
588  const int ms_id, const unsigned int cubit_bc_type,
589  const EntityHandle *entities, int num_entities,
590  const int operation_type = moab::Interface::INTERSECT);
591 
592  /**
593  * \ingroup mofem_meshset_mng
594  * \brief get all CUBIT meshsets by CUBIT type
595  *
596  * \param see CubitBC (NODESET, SIDESET or BLOCKSET and more).
597  * \param meshsets is range of meshsets
598  */
599  MoFEMErrorCode getMeshsetsByType(const unsigned int cubit_bc_type,
600  Range &meshsets) const;
601 
602 
603  /**
604  * \brief add blocksets reading config file
605 
606  Example of config file
607  \code
608 
609  [block_1001]
610 
611  # Example applying attributes to blockset
612 
613  id=2001
614  add=BLOCKSET
615  user1=1.0 # attribute value 1
616  user2=2.0 # you can set up to 10 attributes (if needed could be easily
617  extended to more, let us know)
618  user3=3.0
619 
620  [block_1002]
621 
622  # Example applying material block (isotropic elastic material)
623 
624  id=2002
625  add=BLOCKSET
626  name=MAT_ELASTIC
627  young=10
628  poisson=0.25
629  thermalexpansion=0
630 
631  [block_1003]
632 
633  # Example applying displacement constrains
634 
635  id=2003
636  add=NODESET
637 
638  # Each flag means that boundary consition on displacements is set.
639  disp_flag1=1 # Setting constrains in x- direction
640  disp_flag2=1 # Setting constrains in y- direction
641  disp_flag3=1 # Setting constrains in z- direction
642  disp_flag4=1 # Setting constrains on rotation over x- axis
643  disp_flag5=1 # Setting constrains on rotation over y- axis
644  disp_flag6=1 # Setting constrains on rotation over z-axis
645  disp_ux=1 # value of disp in x- direction
646  disp_uy=2
647  disp_uz=3
648  disp_rx=4 # value of rotation in y-direction
649  disp_ry=5
650  disp_rz=6
651 
652  # Note above values could be interpreted differently if needed.
653 
654  [block_1004]
655 
656  # Example applying force boundary conditions
657 
658  id=2004
659  add=NODESET
660  force_magnitude=1
661  moment_magnitude=1
662  force_fx=1
663  force_fy=1
664  force_fz=1
665  moment_mx=1
666  moment_my=1
667  moment_mz=1
668 
669  [block_1005]
670 
671  # Example applying pressure boundary conditions
672 
673  id=2005
674  add=SIDESET
675  pressure_flag2=1 # 0: Pressure is interpreted as pure pressure 1:
676  pressure is interpreted as total force
677  pressure_magnitude=1
678 
679  # Example applying temperature boundary conditions
680 
681  [block_1006]
682 
683  id=2006
684  add=NODESET
685  temperature_flag1=1 # 0: N/A, 1: temperature value applied
686  temperature_t=1
687 
688  [block_1007]
689 
690  id=2007
691  add=SIDESET
692  heatflux_flag1=1 # 0: N/A, 1: heat flux applied
693  heatflux_magnitude=1
694 
695  [block_1008]
696 
697  # Example applying material block (isotropic thermal material)
698 
699  id=2008
700  add=BLOCKSET
701  name=MAT_THERMAL # Hast to be set for Thermal Mat
702  conductivity=1
703  capacity=1
704 
705  [block_1009]
706 
707  # Example applying interface
708  id=2009
709  add=SIDESET
710  interface_type=1
711 
712  [block_1010]
713 
714  # Example applying material block for interface element
715 
716  id=2010
717  add=BLOCKSET
718  name=MAT_INTERF
719  interface_alpha = 1
720  interface_beta = 0
721  interface_ft = 1
722  interface_Gf = 1
723 
724  \endcode
725 
726  * @param file_name config file
727  * @return error code
728 
729  */
730  MoFEMErrorCode setMeshsetFromFile(const string file_name,
731  const bool clean_file_options = true);
732 
733  /**
734  * \brief get name of config file from line command '-meshsets_config'
735  * @return error code
736 
737  Option is "-meshsets_config file_name.cfg"
738 
739  */
741 
742  /**
743  * @brief save cubit meshset entities on the moab mesh
744  *
745  * @param ms_id id of the cubit meshset (NODESET SIDESET BLOCKSET)
746  * @param cubit_bc_type type of a cubit mesheset
747  * @param file_name optional name for the file
748  * @param file_type optional file type for moab (VTK MOAB)
749  * @param options optional parameters for moab writer (PARALLEL=WRITE_PART)
750  * @return MoFEMErrorCode
751  */
753  saveMeshsetToFile(const int ms_id, const unsigned int cubit_bc_type,
754  const std::string file_name = "out_meshset.vtk",
755  const std::string file_type = "VTK",
756  const std::string options = "") const;
757 
758  /**
759  * @brief save cubit meshset entities on the moab mesh
760  *
761  * @param ms_id id of the cubit meshset
762  * @param cubit_bc_type type of a cubit mesheset (NODESET SIDESET BLOCKSET)
763  * @param dim dimension of the entities
764  * @param file_name optional name for the file
765  * @param file_type optional file type for moab (VTK MOAB)
766  * @param options optional parameters for moab writer (PARALLEL=WRITE_PART)
767  * @return MoFEMErrorCode
768  */
770  const int ms_id, const unsigned int cubit_bc_type, const int dim,
771  const std::string file_name = "out_meshset.vtk",
772  const bool recursive = false, const std::string file_type = "VTK",
773  const std::string options = "") const;
774 
775  /**
776  * \brief Get config file options, use with care
777  * @return error code
778  */
779  inline boost::shared_ptr<boost::program_options::options_description> &
781  return configFileOptionsPtr;
782  }
783 
785 
786 protected:
787  Tag nsTag;
788  Tag ssTag;
791  Tag bhTag;
793 
794  // cubit
796  boost::shared_ptr<boost::program_options::options_description>
797  configFileOptionsPtr; ///< config file options
798 };
799 } // namespace MoFEM
800 
801 #endif //__MESHSETSMANAGER_HPP__
802 
803 /***************************************************************************/ /**
804 * \defgroup mofem_meshset_mng MeshsetsManager
805 * \brief Interface for meshsets with entities with data and boundary conditions
806 *
807 * \ingroup mofem
808 ******************************************************************************/
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