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