v0.9.0
BCMultiIndices.cpp
Go to the documentation of this file.
1 /** \file BCMultiIndices.cpp
2  * \brief Structures for managing boundary conditions
3  */
4 
5 /* MoFEM is free software: you can redistribute it and/or modify it under
6  * the terms of the GNU Lesser General Public License as published by the
7  * Free Software Foundation, either version 3 of the License, or (at your
8  * option) any later version.
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 namespace MoFEM {
20 
21 // moab base meshsets
24  CHKERR moab.tag_get_handle(DIRICHLET_SET_TAG_NAME, nsTag);
25  CHKERR moab.tag_get_handle(NEUMANN_SET_TAG_NAME, ssTag);
26  CHKERR moab.tag_get_handle(
27  (std::string(DIRICHLET_SET_TAG_NAME) + "__BC_DATA").c_str(), nsTag_data);
28  CHKERR moab.tag_get_handle(
29  (std::string(NEUMANN_SET_TAG_NAME) + "__BC_DATA").c_str(), ssTag_data);
30  CHKERR moab.tag_get_handle(MATERIAL_SET_TAG_NAME, bhTag);
31  CHKERR moab.tag_get_handle(BLOCK_HEADER, bhTag_header);
32  CHKERR moab.tag_get_handle(BLOCK_ATTRIBUTES, thBlockAttribs);
33  CHKERR moab.tag_get_handle(NAME_TAG_NAME, entityNameTag);
35 }
36 CubitMeshSets::CubitMeshSets(moab::Interface &moab, const EntityHandle _meshset)
37  : meshset(_meshset), cubitBcType(UNKNOWNSET), msId(nullptr),
38  tag_bc_data(nullptr), tag_bc_size(0), tag_block_header_data(nullptr),
39  tag_block_attributes(nullptr), tag_block_attributes_size(0),
40  tagName(nullptr), meshsets_mask(NODESET | SIDESET | BLOCKSET) {
41 
42  CHKERR getTagsHanlders(moab);
43  CHKERR moab.tag_get_tags_on_entity(meshset, tag_handles);
44  std::vector<Tag>::iterator tit = tag_handles.begin();
45  for (; tit != tag_handles.end(); tit++) {
46  if (*tit == nsTag || *tit == ssTag || *tit == bhTag) {
47  CHKERR moab.tag_get_by_ptr(*tit, &meshset, 1, (const void **)&msId);
48  }
49  if (*tit == nsTag) {
50  if (*msId != -1) {
52  }
53  }
54  if (*tit == ssTag) {
55  if (*msId != -1) {
57  }
58  }
59  if (*tit == bhTag) {
60  if (*msId != -1) {
62  }
63  }
64  if ((*tit == nsTag_data) || (*tit == ssTag_data)) {
65  CHKERR moab.tag_get_by_ptr(*tit, &meshset, 1, (const void **)&tag_bc_data,
66  &tag_bc_size);
67 
69  }
70  if (*tit == bhTag_header) {
71  int tag_length;
72  CHKERR moab.tag_get_length(*tit, tag_length);
73  CHKERR moab.tag_get_by_ptr(*tit, &meshset, 1,
74  (const void **)&tag_block_header_data);
75  if (tag_block_header_data[1] > 0)
77  }
78  if (*tit == thBlockAttribs) {
79  CHKERR moab.tag_get_by_ptr(*tit, &meshset, 1,
80  (const void **)&tag_block_attributes,
82  }
83  if (*tit == entityNameTag) {
84  CHKERR moab.tag_get_by_ptr(entityNameTag, &meshset, 1,
85  (const void **)&tagName);
87  }
88  }
89 
90  // If BC set has name, unset UNKNOWNNAME
91  if (cubitBcType.to_ulong() &
94  if ((cubitBcType & CubitBCType(UNKNOWNNAME)).any()) {
96  }
97  }
98 }
99 CubitMeshSets::CubitMeshSets(moab::Interface &moab,
100  const CubitBCType _cubit_bc_type, const int _ms_id)
101  : cubitBcType(_cubit_bc_type), msId(nullptr), tag_bc_data(nullptr),
102  tag_bc_size(0), tag_block_header_data(nullptr),
103  tag_block_attributes(nullptr), tag_block_attributes_size(0),
104  tagName(nullptr), meshsets_mask(NODESET | SIDESET | BLOCKSET) {
105 
106  CHKERR getTagsHanlders(moab);
107  CHKERR moab.create_meshset(MESHSET_SET | MESHSET_TRACK_OWNER, meshset);
108  switch (cubitBcType.to_ulong()) {
109  case NODESET:
110  CHKERR moab.tag_set_data(nsTag, &meshset, 1, &_ms_id);
111  CHKERR moab.tag_get_by_ptr(nsTag, &meshset, 1, (const void **)&msId);
112  break;
113  case SIDESET:
114  CHKERR moab.tag_set_data(ssTag, &meshset, 1, &_ms_id);
115  CHKERR moab.tag_get_by_ptr(ssTag, &meshset, 1, (const void **)&msId);
116  break;
117  case BLOCKSET:
118  CHKERR moab.tag_set_data(bhTag, &meshset, 1, &_ms_id);
119  CHKERR moab.tag_get_by_ptr(bhTag, &meshset, 1, (const void **)&msId);
120  break;
121  default: {
122  PetscTraceBackErrorHandler(PETSC_COMM_WORLD, __LINE__, PETSC_FUNCTION_NAME,
123  __FILE__, MOFEM_DATA_INCONSISTENCY,
124  PETSC_ERROR_INITIAL, "Unknow meshset type",
125  PETSC_NULL);
126  PetscMPIAbortErrorHandler(PETSC_COMM_WORLD, __LINE__, PETSC_FUNCTION_NAME,
127  __FILE__, MOFEM_DATA_INCONSISTENCY,
128  PETSC_ERROR_INITIAL, "Unknown meshset type",
129  PETSC_NULL);
130  }
131  }
132 }
134  moab::Interface &moab, const int dimension, Range &entities,
135  const bool recursive) const {
137  rval =
138  moab.get_entities_by_dimension(meshset, dimension, entities, recursive);
139  if (rval != MB_SUCCESS) {
140  std::ostringstream ss;
141  ss << "bc set " << *this << std::endl;
142  PetscPrintf(PETSC_COMM_WORLD, ss.str().c_str());
143  }
144  CHKERR rval;
146 }
148  moab::Interface &moab, Range &entities, const bool recursive) const {
150  if ((cubitBcType & CubitBCType(BLOCKSET)).any()) {
151  if (tag_block_header_data != nullptr) {
153  entities, recursive);
154  } else {
155  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "dimension unknown");
156  }
157  }
158  if ((cubitBcType & CubitBCType(NODESET)).any()) {
159  return getMeshsetIdEntitiesByDimension(moab, 0, entities, recursive);
160  }
162 }
164  moab::Interface &moab, const EntityType type, Range &entities,
165  const bool recursive) const {
167  rval = moab.get_entities_by_type(meshset, type, entities, recursive);
168  if (rval != MB_SUCCESS) {
169  std::ostringstream ss;
170  ss << "bc set " << *this << std::endl;
171  PetscPrintf(PETSC_COMM_WORLD, ss.str().c_str());
172  }
173  CHKERR rval;
175 }
176 
177 MoFEMErrorCode CubitMeshSets::getBcData(std::vector<char> &bc_data) const {
179  bc_data.resize(tag_bc_size);
180  copy(&tag_bc_data[0], &tag_bc_data[tag_bc_size], bc_data.begin());
182 }
183 
185  std::vector<unsigned int> &material_data) const {
187  material_data.resize(3);
189  material_data.begin());
191 }
192 
195  if (tag_block_header_data != nullptr) {
196  std::vector<unsigned int> material_data;
197  getBlockHeaderData(material_data);
198  os << "block_header_data = ";
199  std::vector<unsigned int>::iterator vit = material_data.begin();
200  for (; vit != material_data.end(); vit++) {
201  os << std::hex << (int)((unsigned int)*vit) << " ";
202  }
203  os << ": ";
204  vit = material_data.begin();
205  for (; vit != material_data.end(); vit++) {
206  os << *vit;
207  }
208  os << std::endl;
209  } else {
210  os << "no block header data" << std::endl;
211  }
213 }
214 
215 std::string CubitMeshSets::getName() const {
216  if (tagName != nullptr) {
217  return std::string(tagName);
218  } else {
219  return "NoNameSet";
220  }
221 }
222 
223 MoFEMErrorCode CubitMeshSets::printName(std::ostream &os) const {
225  std::string name = getName();
226  os << std::endl;
227  os << "Block name: " << name << std::endl;
229 }
230 
232 CubitMeshSets::getTypeFromBcData(const std::vector<char> &bc_data,
233  CubitBCType &type) const {
235 
236  // See CubitBCType in common.hpp
237  if (bc_data.size() == 0) {
239  }
240 
241  if (strcmp(&bc_data[0], "Displacement") == 0)
242  type |= DISPLACEMENTSET;
243  else if (strcmp(&bc_data[0], "Force") == 0)
244  type |= FORCESET;
245  else if (strcmp(&bc_data[0], "Velocity") == 0)
246  type |= VELOCITYSET;
247  else if (strcmp(&bc_data[0], "Acceleration") == 0)
248  type |= ACCELERATIONSET;
249  else if (strcmp(&bc_data[0], "Temperature") == 0)
250  type |= TEMPERATURESET;
251  else if (strcmp(&bc_data[0], "Pressure") == 0)
252  type |= PRESSURESET;
253  else if (strcmp(&bc_data[0], "HeatFlux") == 0)
254  type |= HEATFLUXSET;
255  else if (strcmp(&bc_data[0], "cfd_bc") == 0)
256  type |= INTERFACESET;
257  else
258  type |= UNKNOWNNAME;
259 
261 }
264  std::vector<char> bc_data;
265  CHKERR getBcData(bc_data);
266  CHKERR getTypeFromBcData(bc_data, type);
268 }
269 
272  std::vector<char> bc_data;
273  CHKERR getBcData(bc_data);
274  os << "bc_data = ";
275  std::vector<char>::iterator vit = bc_data.begin();
276  for (; vit != bc_data.end(); vit++) {
277  os << std::hex << (int)((unsigned char)*vit) << " ";
278  }
279  os << ": ";
280  vit = bc_data.begin();
281  for (; vit != bc_data.end(); vit++) {
282  os << *vit;
283  }
284  os << std::endl;
286 }
287 
289 CubitMeshSets::getAttributes(std::vector<double> &attributes) const {
291  attributes.resize(tag_block_attributes_size);
292  if (tag_block_attributes_size > 0) {
293  copy(&tag_block_attributes[0],
294  &tag_block_attributes[tag_block_attributes_size], attributes.begin());
295  }
297 }
298 
300 CubitMeshSets::setAttributes(moab::Interface &moab,
301  const std::vector<double> &attributes) {
302 
304  int tag_size[] = {(int)attributes.size()};
305  void const *tag_data[] = {&*attributes.begin()};
306  CHKERR moab.tag_set_by_ptr(thBlockAttribs, &meshset, 1, tag_data, tag_size);
307  CHKERR moab.tag_get_by_ptr(thBlockAttribs, &meshset, 1,
308  (const void **)&tag_block_attributes,
311 }
312 
315  std::vector<double> attributes;
316  CHKERR getAttributes(attributes);
317  os << std::endl;
318  os << "Block attributes" << std::endl;
319  os << "----------------" << std::endl;
320  for (unsigned int ii = 0; ii < attributes.size(); ii++) {
321  os << "attr. no: " << ii + 1 << " value: " << attributes[ii] << std::endl;
322  }
323  os << std::endl;
325 }
326 
328  CubitBCType &type) const {
330  // See CubitBCType in common.hpp
331  if (name.compare(0, 11, "MAT_ELASTIC") == 0) {
332  type |= MAT_ELASTICSET;
333  } else if (name.compare(0, 11, "MAT_THERMAL") == 0) {
334  type |= MAT_THERMALSET;
335  } else if (name.compare(0, 12, "MAT_MOISTURE") == 0) {
336  type |= MAT_MOISTURESET;
337  } else if (name.compare(0, 10, "MAT_INTERF") == 0) {
338  type |= MAT_INTERFSET;
339  } else if (name.compare(0, 11, "BODY_FORCES") == 0) {
340  type |= BODYFORCESSET;
341  }
342  // To be extended as appropriate
343  else {
344  type |= UNKNOWNNAME;
345  }
347 }
348 
351  std::string name = getName();
352  CHKERR getTypeFromName(name, type);
354 }
355 
356 std::ostream &operator<<(std::ostream &os, const CubitMeshSets &e) {
357  // get name of cubit meshset
358  std::ostringstream ss;
359  unsigned jj = 0;
360  while (1 << jj != LASTSET_BC) {
361  const CubitBCType jj_bc_type = 1 << jj;
362  if ((e.cubitBcType & jj_bc_type).any()) {
363  string bc_type_name;
364  ss << " " << string(CubitBCNames[jj + 1]);
365  }
366  ++jj;
367  }
368 
369  // push data to stream
370  os << "meshset " << e.meshset << " type" << ss.str();
371  if (e.msId != nullptr)
372  os << " msId " << *(e.msId);
373  if (e.tagName != nullptr) {
374  os << " name " << e.getName();
375  }
376  if (e.tag_block_header_data != nullptr) {
377  os << " block header: ";
378  os << " blockCol = " << e.tag_block_header_data[0];
379  os << " blockMat = " << e.tag_block_header_data[1];
380  os << " blockDimension = " << e.tag_block_header_data[2];
381  }
382  return os;
383 }
384 
385 std::ostream &operator<<(std::ostream &os, const DisplacementCubitBcData &e) {
386  os << "\n";
387  os << "D i s p l a c e m e n t \n \n";
388  os << "Flag for X-Translation (0/1): " << (int)e.data.flag1 << "\n";
389  os << "Flag for Y-Translation (0/1): " << (int)e.data.flag2 << "\n";
390  os << "Flag for Z-Translation (0/1): " << (int)e.data.flag3 << "\n";
391  os << "Flag for X-Rotation (0/1): " << (int)e.data.flag4 << "\n";
392  os << "Flag for Y-Rotation (0/1): " << (int)e.data.flag5 << "\n";
393  os << "Flag for Z-Rotation (0/1): " << (int)e.data.flag6 << "\n \n";
394 
395  if (e.data.flag1 == 1)
396  os << "Displacement magnitude (X-Translation): " << e.data.value1 << "\n";
397  else
398  os << "Displacement magnitude (X-Translation): N/A"
399  << "\n";
400  if (e.data.flag2 == 1)
401  os << "Displacement magnitude (Y-Translation): " << e.data.value2 << "\n";
402  else
403  os << "Displacement magnitude (Y-Translation): N/A"
404  << "\n";
405  if (e.data.flag3 == 1)
406  os << "Displacement magnitude (Z-Translation): " << e.data.value3 << "\n";
407  else
408  os << "Displacement magnitude (Z-Translation): N/A"
409  << "\n";
410  if (e.data.flag4 == 1)
411  os << "Displacement magnitude (X-Rotation): " << e.data.value4 << "\n";
412  else
413  os << "Displacement magnitude (X-Rotation): N/A"
414  << "\n";
415  if (e.data.flag5 == 1)
416  os << "Displacement magnitude (Y-Rotation): " << e.data.value5 << "\n";
417  else
418  os << "Displacement magnitude (Y-Rotation): N/A"
419  << "\n";
420  if (e.data.flag6 == 1)
421  os << "Displacement magnitude (Z-Rotation): " << e.data.value6 << "\n \n";
422  else
423  os << "Displacement magnitude (Z-Rotation): N/A"
424  << "\n \n";
425  return os;
426 }
427 
428 std::ostream &operator<<(std::ostream &os, const ForceCubitBcData &e) {
429  os << "\n";
430  os << "F o r c e \n \n";
431  os << "Force magnitude: " << e.data.value1 << "\n";
432  os << "Moment magnitude: " << e.data.value2 << "\n";
433  os << "Force direction vector (X-component): " << e.data.value3 << "\n";
434  os << "Force direction vector (Y-component): " << e.data.value4 << "\n";
435  os << "Force direction vector (Z-component): " << e.data.value5 << "\n";
436  os << "Moment direction vector (X-component): " << e.data.value6 << "\n";
437  os << "Moment direction vector (Y-component): " << e.data.value7 << "\n";
438  os << "Moment direction vector (Z-component): " << e.data.value8 << "\n \n";
439  return os;
440 }
441 
442 std::ostream &operator<<(std::ostream &os, const VelocityCubitBcData &e) {
443  os << "\n";
444  os << "V e l o c i t y \n \n";
445  if (e.data.flag1 == 1)
446  os << "Velocity magnitude (X-Translation): " << e.data.value1 << "\n";
447  else
448  os << "Velocity magnitude (X-Translation): N/A"
449  << "\n";
450  if (e.data.flag2 == 1)
451  os << "Velocity magnitude (Y-Translation): " << e.data.value2 << "\n";
452  else
453  os << "Velocity magnitude (Y-Translation): N/A"
454  << "\n";
455  if (e.data.flag3 == 1)
456  os << "Velocity magnitude (Z-Translation): " << e.data.value3 << "\n";
457  else
458  os << "Velocity magnitude (Z-Translation): N/A"
459  << "\n";
460  if (e.data.flag4 == 1)
461  os << "Velocity magnitude (X-Rotation): " << e.data.value4 << "\n";
462  else
463  os << "Velocity magnitude (X-Rotation): N/A"
464  << "\n";
465  if (e.data.flag5 == 1)
466  os << "Velocity magnitude (Y-Rotation): " << e.data.value5 << "\n";
467  else
468  os << "Velocity magnitude (Y-Rotation): N/A"
469  << "\n";
470  if (e.data.flag6 == 1)
471  os << "Velocity magnitude (Z-Rotation): " << e.data.value6 << "\n \n";
472  else
473  os << "Velocity magnitude (Z-Rotation): N/A"
474  << "\n \n";
475  return os;
476 }
477 
478 std::ostream &operator<<(std::ostream &os, const AccelerationCubitBcData &e) {
479  os << "\n";
480  os << "A c c e l e r a t i o n \n \n";
481  if (e.data.flag1 == 1)
482  os << "Acceleration magnitude (X-Translation): " << e.data.value1 << "\n";
483  else
484  os << "Acceleration magnitude (X-Translation): N/A"
485  << "\n";
486  if (e.data.flag2 == 1)
487  os << "Acceleration magnitude (Y-Translation): " << e.data.value2 << "\n";
488  else
489  os << "Acceleration magnitude (Y-Translation): N/A"
490  << "\n";
491  if (e.data.flag3 == 1)
492  os << "Acceleration magnitude (Z-Translation): " << e.data.value3 << "\n";
493  else
494  os << "Acceleration magnitude (Z-Translation): N/A"
495  << "\n";
496  if (e.data.flag4 == 1)
497  os << "Acceleration magnitude (X-Rotation): " << e.data.value4 << "\n";
498  else
499  os << "Acceleration magnitude (X-Rotation): N/A"
500  << "\n";
501  if (e.data.flag5 == 1)
502  os << "Acceleration magnitude (Y-Rotation): " << e.data.value5 << "\n";
503  else
504  os << "Acceleration magnitude (Y-Rotation): N/A"
505  << "\n";
506  if (e.data.flag6 == 1)
507  os << "Acceleration magnitude (Z-Rotation): " << e.data.value6 << "\n \n";
508  else
509  os << "Acceleration magnitude (Z-Rotation): N/A"
510  << "\n \n";
511  return os;
512 }
513 
514 std::ostream &operator<<(std::ostream &os, const TemperatureCubitBcData &e) {
515  os << "\n";
516  os << "T e m p e r a t u r e \n \n";
517  if (e.data.flag1 == 1)
518  os << "Temperature: " << e.data.value1 << "\n";
519  else
520  os << "Temperature (default case): N/A"
521  << "\n";
522  if (e.data.flag2 == 1)
523  os << "Temperature (thin shell middle): " << e.data.value2 << "\n";
524  else
525  os << "Temperature (thin shell middle): N/A"
526  << "\n";
527  if (e.data.flag3 == 1)
528  os << "Temperature (thin shell gradient): " << e.data.value3 << "\n";
529  else
530  os << "Temperature (thin shell gradient): N/A"
531  << "\n";
532  if (e.data.flag4 == 1)
533  os << "Temperature (thin shell top): " << e.data.value4 << "\n";
534  else
535  os << "Temperature (thin shell top): N/A"
536  << "\n";
537  if (e.data.flag5 == 1)
538  os << "Temperature (thin shell bottom): " << e.data.value5 << "\n \n";
539  else
540  os << "Temperature (thin shell bottom): N/A"
541  << "\n \n";
542  return os;
543 }
544 
545 std::ostream &operator<<(std::ostream &os, const PressureCubitBcData &e) {
546  os << "\n";
547  os << "P r e s s u r e \n \n";
548  os << "Pressure flag2: " << (int)e.data.flag2 << "\n";
549  os << "Pressure value: " << e.data.value1 << "\n \n";
550  return os;
551 }
552 
553 std::ostream &operator<<(std::ostream &os, const HeatFluxCubitBcData &e) {
554  os << "\n";
555  os << "H e a t F l u x \n \n";
556  if (e.data.flag1 == 1)
557  os << "Heat flux value: " << e.data.value1 << "\n";
558  else
559  os << "Heat flux is applied on thin shells"
560  << "\n";
561  if (e.data.flag2 == 1)
562  os << "Heat flux value (thin shell top): " << e.data.value2 << "\n";
563  else
564  os << "Heat flux value (thin shell top): N/A"
565  << "\n";
566  if (e.data.flag3 == 1)
567  os << "Heat flux value (thin shell bottom): " << e.data.value3 << "\n \n";
568  else
569  os << "Heat flux value (thin shell bottom): N/A"
570  << "\n \n";
571  return os;
572 }
573 
574 std::ostream &operator<<(std::ostream &os, const CfgCubitBcData &e) {
575  os << "\n";
576  os << "CFD BC \n \n";
577  return os;
578 }
579 
580 std::ostream &operator<<(std::ostream &os, const BlockSetAttributes &e) {
581  os << std::endl << "Blcok attributes" << std::endl;
582  os << "-------------------" << std::endl;
583  os << "User attribute 1 = " << e.data.User1 << std::endl;
584  os << "User attribute 2 = " << e.data.User2 << std::endl;
585  os << "User attribute 3 = " << e.data.User3 << std::endl;
586  os << "User attribute 4 = " << e.data.User4 << std::endl;
587  os << "User attribute 5 = " << e.data.User5 << std::endl;
588  os << "User attribute 6 = " << e.data.User6 << std::endl;
589  os << "User attribute 7 = " << e.data.User7 << std::endl;
590  os << "User attribute 8 = " << e.data.User7 << std::endl;
591  os << "User attribute 9 = " << e.data.User7 << std::endl;
592  os << "User attribute 10 = " << e.data.User10 << std::endl << std::endl;
593  return os;
594 }
595 
596 std::ostream &operator<<(std::ostream &os, const Mat_Elastic &e) {
597  os << std::endl << "Material Properties" << std::endl;
598  os << "-------------------" << std::endl;
599  os << "Young's modulus = " << e.data.Young << std::endl;
600  os << "Poisson's ratio = " << e.data.Poisson << std::endl;
601  os << "Thermal expansion = " << e.data.ThermalExpansion << std::endl;
602  os << "User attribute 1 = " << e.data.User1 << std::endl;
603  os << "User attribute 2 = " << e.data.User2 << std::endl;
604  os << "User attribute 3 = " << e.data.User3 << std::endl;
605  os << "User attribute 4 = " << e.data.User4 << std::endl;
606  os << "User attribute 5 = " << e.data.User5 << std::endl;
607  os << "User attribute 6 = " << e.data.User6 << std::endl;
608  os << "User attribute 7 = " << e.data.User7 << std::endl << std::endl;
609  return os;
610 }
611 
612 std::ostream &operator<<(std::ostream &os,
614  os << std::endl << "Material Properties" << std::endl;
615  os << "-------------------" << std::endl;
616  os << "Young's modulus = " << e.data.Young << std::endl;
617  os << "Poisson's ratio = " << e.data.Poisson << std::endl;
618  os << "k1 = " << e.data.k1 << std::endl;
619  os << "k2 = " << e.data.k2 << std::endl;
620  os << "a0_x = " << e.data.a0x << std::endl;
621  os << "a0_y = " << e.data.a0y << std::endl;
622  os << "a0_z = " << e.data.a0z << std::endl;
623  os << "a1_x = " << e.data.a1x << std::endl;
624  os << "a1_y = " << e.data.a1y << std::endl;
625  os << "a1_Z = " << e.data.a1z << std::endl << std::endl;
626  return os;
627 }
628 
629 std::ostream &operator<<(std::ostream &os, const Mat_Thermal &e) {
630  os << std::endl << "Material Properties" << std::endl;
631  os << "-------------------" << std::endl;
632  os << "Conductivity = " << e.data.Conductivity << std::endl;
633  os << "User attribute 1 = " << e.data.HeatCapacity << std::endl;
634  os << "User attribute 2 = " << e.data.User2 << std::endl;
635  os << "User attribute 3 = " << e.data.User3 << std::endl;
636  os << "User attribute 4 = " << e.data.User4 << std::endl;
637  os << "User attribute 5 = " << e.data.User5 << std::endl;
638  os << "User attribute 6 = " << e.data.User6 << std::endl;
639  os << "User attribute 7 = " << e.data.User7 << std::endl;
640  os << "User attribute 8 = " << e.data.User8 << std::endl << std::endl;
641  return os;
642 }
643 
644 std::ostream &operator<<(std::ostream &os, const Mat_Moisture &e) {
645  os << std::endl << "Material Properties" << std::endl;
646  os << "-------------------" << std::endl;
647  os << "Diffusivity = " << e.data.Diffusivity << std::endl;
648  os << "Viscosity = " << e.data.Viscosity << std::endl;
649  os << "Permeability = " << e.data.Permeability << std::endl;
650  os << "User attribute 3 = " << e.data.User3 << std::endl;
651  os << "User attribute 4 = " << e.data.User4 << std::endl;
652  os << "User attribute 5 = " << e.data.User5 << std::endl;
653  os << "User attribute 6 = " << e.data.User6 << std::endl;
654  os << "User attribute 7 = " << e.data.User7 << std::endl;
655  os << "User attribute 8 = " << e.data.User8 << std::endl << std::endl;
656  return os;
657 }
658 
659 std::ostream &operator<<(std::ostream &os, const Block_BodyForces &e) {
660  os << std::endl << "Block Body Forces" << std::endl;
661  os << "-------------------" << std::endl;
662  os << "density = " << e.data.density << std::endl;
663  os << "acceleration_x = " << e.data.acceleration_x << std::endl;
664  os << "acceleration_y = " << e.data.acceleration_y << std::endl;
665  os << "acceleration_z = " << e.data.acceleration_z << std::endl;
666  os << "User attribute 4 = " << e.data.User4 << std::endl;
667  os << "User attribute 5 = " << e.data.User5 << std::endl;
668  os << "User attribute 6 = " << e.data.User6 << std::endl;
669  os << "User attribute 7 = " << e.data.User7 << std::endl;
670  os << "User attribute 8 = " << e.data.User8 << std::endl << std::endl;
671  return os;
672 }
673 
674 std::ostream &operator<<(std::ostream &os, const Mat_Elastic_TransIso &e) {
675  os << std::endl << "Material Properties" << std::endl;
676  os << "-------------------" << std::endl;
677  os << "Young's modulus in xy plane (Ep) = " << e.data.Youngp << std::endl;
678  os << "Young's modulus in z-direction (Ez) = " << e.data.Youngz << std::endl;
679  os << "Poisson's ratio in xy plane (vp) = " << e.data.Poissonp
680  << std::endl;
681  os << "Poisson's ratio in z-direction (vpz) = " << e.data.Poissonpz
682  << std::endl;
683  os << "Shear modulus in z-direction (Gzp) = " << e.data.Shearzp << std::endl
684  << std::endl;
685  return os;
686 }
687 
688 std::ostream &operator<<(std::ostream &os, const Mat_Interf &e) {
689  os << std::endl << "Material Properties" << std::endl;
690  os << "-------------------" << std::endl;
691  os << "Elastic module = " << e.data.alpha << std::endl << std::endl;
692  os << "Damage coupling = " << e.data.beta << std::endl << std::endl;
693  os << "Strengh = " << e.data.ft << std::endl << std::endl;
694  os << "Fracture energy = " << e.data.Gf << std::endl << std::endl;
695 
696  return os;
697 }
698 
700 
701  switch (e.cubitBcType.to_ulong()) {
702  case BLOCKSET: {
703  nAme.resize(NAME_TAG_SIZE);
704  CHKERR mOab.tag_set_data(e.entityNameTag, &e.meshset, 1, nAme.c_str());
705  CHKERR mOab.tag_get_by_ptr(e.entityNameTag, &e.meshset, 1,
706  (const void **)&e.tagName);
707 
708  CubitBCType type;
709  CHKERR e.getTypeFromName(type);
710  e.cubitBcType |= type;
711  }; break;
712  case NODESET:
713  case SIDESET: {
714  nAme.resize(NAME_TAG_SIZE);
715  CHKERR mOab.tag_set_data(e.entityNameTag, &e.meshset, 1, nAme.c_str());
716  CHKERR mOab.tag_get_by_ptr(e.entityNameTag, &e.meshset, 1,
717  (const void **)&e.tagName);
718  }; break;
719  default:
720  THROW_MESSAGE("not implemented for this CubitBC type");
721  }
722 }
723 
726  e.cubitBcType |= bIt;
727 }
728 
731 }
732 
735  // Need to run this to set tag size in number of doubles, don;t know nothing
736  // about structure
737  int tag_size[] = {(int)(aTtr.getSizeOfData() / sizeof(double))};
738  void const *tag_data[] = {aTtr.getDataPtr()};
739  CHKERR mOab.tag_set_by_ptr(e.thBlockAttribs, &e.meshset, 1, tag_data,
740  tag_size);
741  CHKERR mOab.tag_get_by_ptr(e.thBlockAttribs, &e.meshset, 1,
742  (const void **)&e.tag_block_attributes,
744  // Here I know about structure
746 }
747 
749 
750  // Need to run this to set tag size, don;t know nothing about structure
751  int tag_size[] = {(int)bcData.getSizeOfData()};
752  void const *tag_data[] = {bcData.getDataPtr()};
753  if ((e.cubitBcType & CubitBCType(NODESET)).any()) {
754  CHKERR mOab.tag_set_by_ptr(e.nsTag_data, &e.meshset, 1, tag_data, tag_size);
755  CHKERR mOab.tag_get_by_ptr(e.nsTag_data, &e.meshset, 1,
756  (const void **)&e.tag_bc_data, &e.tag_bc_size);
757  } else if ((e.cubitBcType & CubitBCType(SIDESET)).any()) {
758  CHKERR mOab.tag_set_by_ptr(e.ssTag_data, &e.meshset, 1, tag_data, tag_size);
759  CHKERR mOab.tag_get_by_ptr(e.ssTag_data, &e.meshset, 1,
760  (const void **)&e.tag_bc_data, &e.tag_bc_size);
761  } else {
762  THROW_MESSAGE("You have to have NODESET or SIDESET to apply BC data on it");
763  }
764  // Here I know about structure
766  // Get Type form BC data
768 }
769 
770 } // namespace MoFEM
Definition of the temperature bc data structure.
Definition: BCData.hpp:311
MoFEMErrorCode printBcData(std::ostream &os) const
print bc_data int stream given by os
block name is "MAT_MOISTURE"
Definition: definitions.h:226
MoFEMErrorCode printAttributes(std::ostream &os) const
print the attributes vector
CubitMeshSets(Interface &moab, const EntityHandle _meshset)
MoFEMErrorCode printBlockHeaderData(std::ostream &os) const
print material_data int stream given by os
Elastic material data structure.
MoFEMErrorCode getMeshsetIdEntitiesByDimension(Interface &moab, const int dimension, Range &entities, const bool recursive=false) const
get entities form meshset
#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 getTagsHanlders(Interface &moab)
virtual std::size_t getSizeOfData() const =0
get data structure size
const std::vector< double > & aTtr
Transverse Isotropic material data structure.
#define THROW_MESSAGE(a)
Throw MoFEM exception.
Definition: definitions.h:620
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:21
std::vector< Tag > tag_handles
vector of tag handles to types of data passed from cubit
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:84
std::ostream & operator<<(std::ostream &os, const DataForcesAndSourcesCore::EntData &e)
virtual const void * getDataPtr() const =0
get pointer to data structure
Definition of the force bc data structure.
Definition: BCData.hpp:147
Definition of the displacement bc data structure.
Definition: BCData.hpp:87
Thermal material data structure.
MoFEMErrorCode getBlockHeaderData(std::vector< unsigned int > &material_data) const
get block_headers vector from MoFEM database
MoFEMErrorCode setBcDataStructure(CUBIT_BC_DATA_TYPE &data)
MoFEMErrorCode getTypeFromName(const std::string &name, CubitBCType &type) const
Function that returns the CubitBCType type of the block name, sideset name etc.
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:66
Definition of the acceleration bc data structure.
Definition: BCData.hpp:254
std::string getName() const
get name of block, sideset etc. (this is set in Cubit block properties)
Linear interface data structure.
block name is "MAT_THERMAL"
Definition: definitions.h:224
Definition of the cfd_bc data structure.
Definition: BCData.hpp:466
block name is "BODY_FORCES"
Definition: definitions.h:225
Body force data structure.
MoFEMErrorCode getAttributes(std::vector< double > &attributes) const
get Cubit block attributes
#define CHKERR
Inline error check.
Definition: definitions.h:596
block name is "MAT_ELASTIC"
Definition: definitions.h:222
MoFEMErrorCode printName(std::ostream &os) const
print name of block, sideset etc. (this is set in Cubit setting properties)
MoFEMErrorCode getMeshsetIdEntitiesByType(Interface &moab, const EntityType type, Range &entities, const bool recursive=false) const
get entities by type
Arbitrary block attributes data structure.
MoFEMErrorCode getTypeFromBcData(const std::vector< char > &bc_data, CubitBCType &type) const
Function that returns the CubitBCType type of the contents of bc_data.
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
void operator()(CubitMeshSets &e)
virtual std::size_t getSizeOfData() const =0
get data structure size
unsigned int * tag_block_header_data
moisture transport material data structure
static const char *const CubitBCNames[]
Names of types of sets and boundary conditions.
Definition: definitions.h:238
int * msId
cubit meshset ID
virtual const void * getDataPtr() const =0
get pointer to data structure
MoFEMErrorCode setAttributes(moab::Interface &moab, const std::vector< double > &attributes)
cet Cubit block attributes
Definition of the heat flux bc data structure.
Definition: BCData.hpp:415
MoFEMErrorCode setAttributeDataStructure(const ATTRIBUTE_TYPE &data)
fill meshset data with data on structure
Definition of the pressure bc data structure.
Definition: BCData.hpp:367
MoFEMErrorCode getBcData(std::vector< char > &bc_data) const
get bc_data vector from MoFEM database
Definition of the velocity bc data structure.
Definition: BCData.hpp:199