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