v0.16.0
Loading...
Searching...
No Matches
MeshsetsManager.cpp
Go to the documentation of this file.
1/** \file MeshsetsManager.cpp
2 * \brief Interface to manage meshsets which carrying information about boundary
3 * conditions and material blocks
4 *
5 */
6
7using namespace std;
8namespace po = boost::program_options;
9
10namespace MoFEM {
11
13 std::vector<const CubitMeshSets *> &vec_ptr) {
14 std::sort(vec_ptr.begin(), vec_ptr.end(),
15 [](const CubitMeshSets *a, const CubitMeshSets *b) {
16 if (a->getBcType().to_ullong() < b->getBcType().to_ullong())
17 return true;
18 if (a->getBcType().to_ullong() > b->getBcType().to_ullong())
19 return false;
20 else
21 return a->getMeshsetId() < b->getMeshsetId();
22 });
23}
24
26
28MeshsetsManager::query_interface(boost::typeindex::type_index type_index,
29 UnknownInterface **iface) const {
30 *iface = const_cast<MeshsetsManager *>(this);
31 return 0;
32}
33
35 : cOre(const_cast<Core &>(core)) {
36
37 if (!LogManager::checkIfChannelExist("MeshsetMngWorld")) {
38 auto core_log = logging::core::get();
39
40 core_log->add_sink(
42 core_log->add_sink(
44 core_log->add_sink(
46
47 LogManager::setLog("MeshsetMngWorld");
48 LogManager::setLog("MeshsetMngSync");
49 LogManager::setLog("MeshsetMngSelf");
50
51 MOFEM_LOG_TAG("MeshsetMngWorld", "MeshsetMng");
52 MOFEM_LOG_TAG("MeshsetMngSync", "MeshsetMng");
53 MOFEM_LOG_TAG("MeshsetMngSelf", "MeshsetMng");
54 }
55
56 MOFEM_LOG("MeshsetMngWorld", Sev::noisy) << "Mashset manager created";
57}
58
64
66 std::size_t *cleared_names, std::size_t *cleared_attributes,
67 const bool clear_names, const bool clear_attributes) {
68 Interface &m_field = cOre;
69 moab::Interface &moab = m_field.get_moab();
71
72 Tag block_attributes;
73 CHKERR moab.tag_get_handle(BLOCK_ATTRIBUTES, block_attributes);
74
75 Tag entity_name_tag;
76 CHKERR moab.tag_get_handle(NAME_TAG_NAME, entity_name_tag);
77
78 std::vector<EntityHandle> block_meshsets;
79 block_meshsets.reserve(cubitMeshsets.size());
80 for (const auto &meshset : cubitMeshsets) {
81 if ((meshset.getBcType() & CubitBCType(BLOCKSET)).any()) {
82 block_meshsets.push_back(meshset.getMeshset());
83 }
84 }
85
86 std::sort(block_meshsets.begin(), block_meshsets.end());
87 block_meshsets.erase(
88 std::unique(block_meshsets.begin(), block_meshsets.end()),
89 block_meshsets.end());
90
91 std::size_t local_cleared_names = 0;
92 std::size_t local_cleared_attributes = 0;
93 for (const auto meshset : block_meshsets) {
94 std::vector<Tag> tag_handles;
95 CHKERR moab.tag_get_tags_on_entity(meshset, tag_handles);
96 if (clear_names &&
97 std::find(tag_handles.begin(), tag_handles.end(), entity_name_tag) !=
98 tag_handles.end()) {
99 CHKERR moab.tag_delete_data(entity_name_tag, &meshset, 1);
100 ++local_cleared_names;
101 }
102 if (clear_attributes &&
103 std::find(tag_handles.begin(), tag_handles.end(), block_attributes) !=
104 tag_handles.end()) {
105 CHKERR moab.tag_delete_data(block_attributes, &meshset, 1);
106 ++local_cleared_attributes;
107 }
108 }
109
110 if (cleared_names) {
111 *cleared_names = local_cleared_names;
112 }
113 if (cleared_attributes) {
114 *cleared_attributes = local_cleared_attributes;
115 }
116
118}
119
121 Interface &m_field = cOre;
123 CHKERR readMeshsets(verb);
126
127 std::vector<const CubitMeshSets *> vec_ptr;
128 for (auto &m : cubitMeshsets) {
129 vec_ptr.push_back(&m);
130 }
131 sortMeshsets(vec_ptr);
132
133 for (auto m_ptr : vec_ptr) {
134 MOFEM_LOG("MeshsetMngWorld", Sev::inform)
135 << "meshset in database " << *m_ptr;
136 }
137 // Verbose synchronised print
138 for (auto m_ptr : vec_ptr) {
139 MOFEM_LOG("MeshsetMngSync", Sev::verbose)
140 << "meshset in database " << *m_ptr;
141 }
142 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::verbose);
143
145}
146
148 Interface &m_field = cOre;
149 moab::Interface &moab = m_field.get_moab();
151
152 Range meshsets;
153 CHKERR moab.get_entities_by_type(0, MBENTITYSET, meshsets, false);
154 for (auto m : meshsets) {
155 // check if meshset is cubit meshset
156 CubitMeshSets block(moab, m);
157 if ((block.cubitBcType & CubitBCType(NODESET | SIDESET | BLOCKSET)).any()) {
158 auto p = cubitMeshsets.insert(block);
159 if (!p.second) {
160 // blockset/nodeset/sideset set exist, could be created on other
161 // processor.
162 Range ents;
163 CHKERR m_field.get_moab().get_entities_by_handle(m, ents, true);
164 CHKERR m_field.get_moab().add_entities(p.first->getMeshset(), ents);
165 CHKERR m_field.get_moab().delete_entities(&m, 1);
166 }
167 }
168 }
169
170 std::vector<const CubitMeshSets *> vec_ptr;
171 for (auto &m : cubitMeshsets) {
172 vec_ptr.push_back(&m);
173 }
174 sortMeshsets(vec_ptr);
175
176 for (auto m_ptr : vec_ptr) {
177 MOFEM_LOG("MeshsetMngSync", Sev::verbose) << "read " << *m_ptr;
178 }
179 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::verbose);
180
182}
183
185 Interface &m_field = cOre;
186 moab::Interface &moab = m_field.get_moab();
188
189 ParallelComm *pcomm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
190 if (pcomm == NULL)
191 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
192 "MOAB communicator not set");
193
194 auto all_to_all = [&](Range &verts, std::vector<Range> &recv_verts) {
196 int success;
197 int buff_size;
198 ParallelComm::Buffer buff_send(ParallelComm::INITIAL_BUFF_SIZE);
199 buff_send.reset_ptr(sizeof(int));
200 CHKERR pcomm->pack_buffer(verts, false, true, false, -1, &buff_send);
201 buff_send.set_stored_size();
202 buff_size = buff_send.buff_ptr - buff_send.mem_ptr;
203
204 std::vector<int> recv_buff_sizes(pcomm->size(), 0);
205 success =
206 MPI_Allgather(&buff_size, 1, MPI_INT, recv_buff_sizes.data(), 1,
207 MPI_INT,
208 pcomm->comm());
209 if (success != MPI_SUCCESS)
210 SETERRQ(pcomm->comm(), MOFEM_DATA_INCONSISTENCY,
211 "MPI_Allgather failed");
212
213 std::vector<int> recv_buff_displs(
214 recv_buff_sizes.size(),
215 0); // that is relative (position) displacements in recv buffer
216 int recv_buff_size = 0;
217 for (std::size_t proc = 0; proc != recv_buff_sizes.size(); ++proc) {
218 recv_buff_displs[proc] = recv_buff_size;
219 recv_buff_size += recv_buff_sizes[proc];
220 }
221
222 std::vector<unsigned char> recv_buff(recv_buff_size);
223 success = MPI_Allgatherv(
224 buff_send.mem_ptr, buff_size, MPI_UNSIGNED_CHAR, recv_buff.data(),
225 recv_buff_sizes.data(), recv_buff_displs.data(), MPI_UNSIGNED_CHAR,
226 pcomm->comm());
227 if (success != MPI_SUCCESS)
228 SETERRQ(pcomm->comm(), MOFEM_DATA_INCONSISTENCY,
229 "MPI_Allgatherv failed");
230
231 recv_verts.clear();
232 recv_verts.resize(pcomm->size());
233 for (int from_proc = 0; from_proc < pcomm->size(); ++from_proc) {
234 if (from_proc == pcomm->rank())
235 continue;
236 if (recv_buff_sizes[from_proc] < static_cast<int>(sizeof(int)))
237 SETERRQ(pcomm->comm(), MOFEM_DATA_INCONSISTENCY,
238 "Received meshset buffer is too small");
239
240 std::vector<std::vector<EntityHandle>> L1hloc, L1hrem;
241 std::vector<std::vector<int>> L1p;
242 std::vector<EntityHandle> L2hloc, L2hrem, recv_ents;
243 std::vector<unsigned int> L2p;
244 auto *recv_ptr =
245 recv_buff.data() + recv_buff_displs[from_proc] + sizeof(int);
246 CHKERR pcomm->unpack_buffer(recv_ptr, false, from_proc, -1, L1hloc,
247 L1hrem, L1p, L2hloc, L2hrem, L2p, recv_ents);
248 recv_verts[from_proc].insert_list(recv_ents.begin(), recv_ents.end());
249 }
250
252 };
253
254 const double coords[] = {0, 0, 0};
255
256 auto set_tags_dummy_node = [&](const EntityHandle dummy_node,
257 const EntityHandle meshset) {
259 std::vector<Tag> tag_handles;
260 CHKERR moab.tag_get_tags_on_entity(meshset, tag_handles);
261 for (auto th : tag_handles) {
262 void *data[1];
263 int tag_size;
264 CHKERR moab.tag_get_by_ptr(th, &meshset, 1, (const void **)data,
265 &tag_size);
266 if (tag_size > 0)
267 CHKERR moab.tag_set_by_ptr(th, &dummy_node, 1, data, &tag_size);
268 }
270 };
271
272 for (auto t : {NODESET, SIDESET, BLOCKSET}) {
273 std::vector<const CubitMeshSets *> vec_ptr;
274 for (auto &m : cubitMeshsets) {
275 if ((m.getBcType() & CubitBCType(t)).any()) {
276 vec_ptr.push_back(&m);
277 }
278 }
279 sortMeshsets(vec_ptr);
280
281 std::vector<EntityHandle> vec_meshsets;
282 vec_meshsets.reserve(vec_ptr.size());
283 for (auto m_ptr : vec_ptr) {
284 vec_meshsets.push_back(m_ptr->getMeshset());
285 }
286
287 switch (t) {
288 case NODESET:
289 MOFEM_LOG("MeshsetMngSync", Sev::verbose)
290 << "broadcast NODESET " << vec_meshsets.size();
291 break;
292 case SIDESET:
293 MOFEM_LOG("MeshsetMngSync", Sev::verbose)
294 << "broadcast SIDESET " << vec_meshsets.size();
295 break;
296 case BLOCKSET:
297 MOFEM_LOG("MeshsetMngSync", Sev::verbose)
298 << "broadcast BLOCKSET " << vec_meshsets.size();
299 break;
300 default:
301 MOFEM_LOG("MeshsetMngSync", Sev::verbose)
302 << "broadcast Unknown " << vec_meshsets.size();
303 }
304
305 Range r_dummy_nodes;
306 std::vector<EntityHandle> dummy_nodes(vec_meshsets.size(), 0);
307 int i = 0;
308 for (auto m : vec_meshsets) {
309 CHKERR moab.create_vertex(coords, dummy_nodes[i]);
310 CHKERR set_tags_dummy_node(dummy_nodes[i], m);
311 ++i;
312 }
313 r_dummy_nodes.insert_list(dummy_nodes.begin(), dummy_nodes.end());
314
315 std::vector<Range> recv_dummy_nodes;
316 CHKERR all_to_all(r_dummy_nodes, recv_dummy_nodes);
317
318 for (int from_proc = 0; from_proc < pcomm->size(); ++from_proc) {
319 if (from_proc != pcomm->rank()) {
320 for (auto dummy_node : recv_dummy_nodes[from_proc]) {
321 CubitMeshSets broadcast_block(moab, dummy_node);
322 auto id = broadcast_block.getMeshsetId();
323 if (id != -1) {
324 auto mit =
326 .find(boost::make_tuple(
327 id, broadcast_block.getMaskedBcTypeULong()));
328 if (mit ==
330 .end()) {
332 CHKERR moab.create_meshset(MESHSET_SET, m);
333 CHKERR set_tags_dummy_node(m, dummy_node);
334 auto hint = cubitMeshsets.end();
335 /*auto p = */ cubitMeshsets.emplace_hint(hint, moab, m);
336 }
337 } else {
338 MOFEM_LOG("MeshsetMngSync", Sev::warning)
339 << "broadcasted vertex " << dummy_node << " has negative id";
340 }
341 }
342 } else {
343 MOFEM_LOG("MeshsetMngSync", Sev::verbose)
344 << "broadcast send from " << from_proc;
345 }
346 CHKERR moab.delete_entities(recv_dummy_nodes[from_proc]);
347 }
348
349 CHKERR moab.delete_entities(r_dummy_nodes);
350
351 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::verbose);
352 }
353
355}
356
359 Interface &m_field = cOre;
360 moab::Interface &moab = m_field.get_moab();
362 bhTag_header, verb);
364}
365
366MoFEMErrorCode MeshsetsManager::getTags(moab::Interface &moab, Tag &nsTag,
367 Tag &ssTag, Tag &nsTag_data,
368 Tag &ssTag_data, Tag &bhTag,
369 Tag &bhTag_header, int verb) {
371
372 int default_val = -1;
373 CHKERR moab.tag_get_handle(DIRICHLET_SET_TAG_NAME, 1, MB_TYPE_INTEGER, nsTag,
374 MB_TAG_SPARSE | MB_TAG_CREAT, &default_val);
375
376 CHKERR moab.tag_get_handle(NEUMANN_SET_TAG_NAME, 1, MB_TYPE_INTEGER, ssTag,
377 MB_TAG_SPARSE | MB_TAG_CREAT, &default_val);
378
379 const int def_bc_data_len = 0;
380 std::string tag_name = std::string(DIRICHLET_SET_TAG_NAME) + "__BC_DATA";
381 CHKERR moab.tag_get_handle(
382 tag_name.c_str(), def_bc_data_len, MB_TYPE_OPAQUE, nsTag_data,
383 MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES | MB_TAG_VARLEN, NULL);
384
385 tag_name = std::string(NEUMANN_SET_TAG_NAME) + "__BC_DATA";
386 CHKERR moab.tag_get_handle(
387 tag_name.c_str(), def_bc_data_len, MB_TYPE_OPAQUE, ssTag_data,
388 MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES | MB_TAG_VARLEN, NULL);
389
390 CHKERR moab.tag_get_handle(MATERIAL_SET_TAG_NAME, 1, MB_TYPE_INTEGER, bhTag,
391 MB_TAG_SPARSE | MB_TAG_CREAT, &default_val);
392
393 std::vector<unsigned int> def_uint_zero(3, 0);
394 CHKERR moab.tag_get_handle(
395 BLOCK_HEADER, 3 * sizeof(unsigned int), MB_TYPE_INTEGER, bhTag_header,
396 MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES, &def_uint_zero[0]);
397
398 Tag block_attribs;
399 int def_Block_Attributes_length = 0;
400 CHKERR moab.tag_get_handle(
401 BLOCK_ATTRIBUTES, def_Block_Attributes_length, MB_TYPE_DOUBLE,
402 block_attribs, MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_VARLEN, NULL);
403
404 Tag entity_name_tag;
405 CHKERR moab.tag_get_handle(NAME_TAG_NAME, NAME_TAG_SIZE, MB_TYPE_OPAQUE,
406 entity_name_tag, MB_TAG_SPARSE | MB_TAG_CREAT);
407
409}
410
417
424
431
438
445
448 const Interface &m_field = cOre;
449 const moab::Interface &moab = m_field.get_moab();
451 (*this), BLOCKSET | MAT_ELASTICSET, it)) {
452 Mat_Elastic data;
453 CHKERR it->getAttributeDataStructure(data);
454 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *it;
455 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << data;
456 Range tets;
457 CHKERR moab.get_entities_by_dimension(it->meshset, 3, tets, true);
458 MOFEM_LOG("MeshsetMngWorld", Sev::inform)
459 << "MAT_ELATIC msId " << it->getMeshsetId() << " nb. volumes "
460 << tets.size();
461 }
462
464 m_field, BLOCKSET | MAT_THERMALSET, it)) {
465 Mat_Thermal data;
466 CHKERR it->getAttributeDataStructure(data);
467 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *it;
468 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << data;
469 }
470
472 m_field, BLOCKSET | MAT_MOISTURESET, it)) {
473 Mat_Moisture data;
474 CHKERR it->getAttributeDataStructure(data);
475 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *it;
476 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << data;
477 }
479}
480
481bool MeshsetsManager::checkMeshset(const int ms_id,
482 const CubitBCType cubit_bc_type) const {
483 auto miit =
485 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
486 if (miit !=
488 return true;
489 }
490 return false;
491}
492
493bool MeshsetsManager::checkMeshset(const string name,
494 int *const number_of_meshsets_ptr) const {
495 auto miit = cubitMeshsets.get<CubitMeshsets_name>().lower_bound(name);
496 auto hi_miit = cubitMeshsets.get<CubitMeshsets_name>().upper_bound(name);
497 if (std::distance(miit, hi_miit) == 0) {
498 return false;
499 }
500 if (number_of_meshsets_ptr) {
501 *number_of_meshsets_ptr = std::distance(miit, hi_miit);
502 }
503 return true;
504}
505
507 const int ms_id,
508 const std::string name) {
509 Interface &m_field = cOre;
510 moab::Interface &moab = m_field.get_moab();
512 if (checkMeshset(ms_id, cubit_bc_type)) {
513 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
514 "such cubit meshset is already there id = %d", ms_id);
515 }
516
517 CubitMeshSets cmeshset(moab, cubit_bc_type, ms_id);
518 if ((cmeshset.cubitBcType & CubitBCType(NODESET | SIDESET | BLOCKSET))
519 .any()) {
520 auto p = cubitMeshsets.insert(cmeshset);
521 if (!p.second) {
522 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
523 "meshset not inserted");
524 }
525 if (name.size() > 0) {
526 bool success =
527 cubitMeshsets.modify(p.first, CubitMeshSets_change_name(moab, name));
528 if (!success) {
529 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
530 "name to cubit meshset can not be set");
531 }
532 }
533 }
534
536}
537
539 const CubitBCType cubit_bc_type, const int ms_id,
540 const CubitBCType type_bit) {
541 Interface &m_field = cOre;
543 // Update the meshset classification in-place without changing its entities.
544 auto cit =
546 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
547 if (cit ==
549 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
550 "Cannot find Cubit meshset with id: %d", ms_id);
551 }
552 const bool success = cubitMeshsets.modify(
553 cubitMeshsets.project<0>(cit),
555 if (!success) {
556 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
557 "modification unsuccessful");
558 }
560}
561
564 const int ms_id, const Range &ents) {
565 Interface &m_field = cOre;
566 moab::Interface &moab = m_field.get_moab();
568 auto cit =
570 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
571 if (cit ==
573 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
574 "Cannot find Cubit meshset with id: %d", ms_id);
575 }
576 EntityHandle meshset = cit->getMeshset();
577 CHKERR moab.add_entities(meshset, ents);
578
580}
581
584 const int ms_id, const EntityHandle *ents,
585 const int nb_ents) {
586 Interface &m_field = cOre;
587 moab::Interface &moab = m_field.get_moab();
589 auto cit =
591 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
592 if (cit ==
594 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
595 "Cannot find Cubit meshset with id: %d", ms_id);
596 }
597 EntityHandle meshset = cit->getMeshset();
598 CHKERR moab.add_entities(meshset, ents, nb_ents);
599
601}
602
604MeshsetsManager::setAttributes(const CubitBCType cubit_bc_type, const int ms_id,
605 const std::vector<double> &attributes,
606 const std::string name) {
607 Interface &m_field = cOre;
608 moab::Interface &moab = m_field.get_moab();
610 auto cit =
612 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
613 if (cit ==
615 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
616 "Cannot find Cubit meshset with id: %d", ms_id);
617 }
618 if (name.size() > 0) {
619 bool success = cubitMeshsets.modify(cubitMeshsets.project<0>(cit),
620 CubitMeshSets_change_name(moab, name));
621 if (!success) {
622 SETERRQ(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
623 "name to cubit meshset can not be set");
624 }
625 }
626 bool success =
627 cubitMeshsets.modify(cubitMeshsets.project<0>(cit),
628 CubitMeshSets_change_attributes(moab, attributes));
629 if (!success)
630 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
631 "modification unsuccessful");
632
633 std::ostringstream ss;
634 ss << "Block " << cit->getName();
635 ss << " Add attr: ";
636 for (unsigned int ii = 0; ii != attributes.size(); ii++) {
637 ss << attributes[ii] << " ";
638 }
639 MOFEM_LOG("MeshsetMngSelf", Sev::noisy) << ss.str();
640
642}
643
645 const int ms_id,
646 const std::string &name) {
647 Interface &m_field = cOre;
648 moab::Interface &moab = m_field.get_moab();
650 auto cit =
652 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
653 if (cit ==
655 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
656 "Cannot find Cubit meshset with id: %d", ms_id);
657 }
658 const bool success = cubitMeshsets.modify(cubitMeshsets.project<0>(cit),
659 CubitMeshSets_change_name(moab, name));
660 if (!success)
661 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
662 "name to cubit meshset can not be set");
664}
665
667 const CubitBCType cubit_bc_type, const int ms_id,
668 const GenericAttributeData &data, const std::string name) {
669 Interface &m_field = cOre;
670 moab::Interface &moab = m_field.get_moab();
672 auto cit =
674 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
675 if (cit ==
677 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
678 "Cannot find Cubit meshset with id: %d", ms_id);
679 }
680 if (name.size() > 0) {
681 bool success = cubitMeshsets.modify(cubitMeshsets.project<0>(cit),
682 CubitMeshSets_change_name(moab, name));
683 if (!success) {
684 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
685 "name to cubit meshset can not be set");
686 }
687 }
688 bool success = cubitMeshsets.modify(
689 cubitMeshsets.project<0>(cit),
691 if (!success)
692 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
693 "modification unsuccessful");
695}
696
698 const int ms_id,
699 const GenericCubitBcData &data) {
700 Interface &m_field = cOre;
701 moab::Interface &moab = m_field.get_moab();
703 auto cit =
705 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
706 if (cit ==
708 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
709 "Cubit meshset with id is already there id = %d", ms_id);
710 }
711 bool success =
712 cubitMeshsets.modify(cubitMeshsets.project<0>(cit),
714 if (!success)
715 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
716 "modification unsuccessful");
718}
719
721 const int ms_id,
722 const MoFEMTypes bh) {
723 Interface &m_field = cOre;
724 moab::Interface &moab = m_field.get_moab();
726 auto miit =
728 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
729 if (miit ==
731 if (bh & MF_EXIST) {
732 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
733 "meshset not found id = %d", ms_id);
734 } else {
736 }
737 }
738 EntityHandle meshset = miit->getMeshset();
740 CHKERR moab.delete_entities(&meshset, 1);
741
743}
744
746 const int ms_id, const CubitBCType cubit_bc_type,
747 const CubitMeshSets **cubit_meshset_ptr) const {
748 Interface &m_field = cOre;
750 auto miit =
752 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
753 if (miit !=
755 *cubit_meshset_ptr = &*miit;
756 } else {
757 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
758 "msId = %d is not there", ms_id);
759 }
761}
762
763const CubitMeshSets *
765 const CubitBCType cubit_bc_type) const {
766 const CubitMeshSets *cubit_meshset_ptr;
768 getCubitMeshsetPtr(ms_id, cubit_bc_type, &cubit_meshset_ptr),
769 "Get not get meshset");
770 return cubit_meshset_ptr;
771}
772
774 const string name, const CubitMeshSets **cubit_meshset_ptr) const {
775 Interface &m_field = cOre;
777 auto miit = cubitMeshsets.get<CubitMeshsets_name>().lower_bound(name);
778 auto hi_miit = cubitMeshsets.get<CubitMeshsets_name>().upper_bound(name);
779 if (std::distance(miit, hi_miit) == 0) {
780 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
781 "meshset name <%s> is not there", name.c_str());
782 }
783 if (std::distance(miit, hi_miit) > 1) {
784 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
785 "more that one meshser of that name <%s>", name.c_str());
786 }
787 *cubit_meshset_ptr = &*miit;
789}
790
792 const CubitBCType cubit_bc_type,
793 std::vector<const CubitMeshSets *> &vec_ptr) const {
795 auto r = cubitMeshsets.get<CubitMeshsetType_mi_tag>().equal_range(
796 cubit_bc_type.to_ulong());
797 for (auto it = r.first; it != r.second; ++it) {
798 vec_ptr.push_back(&*it);
799 }
800 sortMeshsets(vec_ptr);
802}
803
804std::vector<const CubitMeshSets *>
806 std::vector<const CubitMeshSets *> vec_ptr;
807 CHK_MOAB_THROW(getCubitMeshsetPtr(cubit_bc_type, vec_ptr),
808 "Error in getting meshsets by name");
809 return vec_ptr;
810}
811
813 const std::regex reg_exp_name,
814 std::vector<const CubitMeshSets *> &vec_ptr) const {
816 auto r =
818 for (; r.first != r.second; ++r.first) {
819 const auto name = r.first->getName();
820 if (std::regex_match(name, reg_exp_name)) {
821 vec_ptr.push_back(&*r.first);
822 }
823 }
824 sortMeshsets(vec_ptr);
826}
827
828std::vector<const CubitMeshSets *>
829MeshsetsManager::getCubitMeshsetPtr(const std::regex reg_exp_name) const {
830 std::vector<const CubitMeshSets *> vec_ptr;
831 CHK_MOAB_THROW(getCubitMeshsetPtr(reg_exp_name, vec_ptr),
832 "Error in getting meshsets by name");
833 return vec_ptr;
834}
835
837 const int msId, const unsigned int cubit_bc_type, const int dimension,
838 Range &entities, const bool recursive) const {
839 Interface &m_field = cOre;
840 moab::Interface &moab = m_field.get_moab();
842 auto miit =
844 boost::make_tuple(msId, cubit_bc_type));
845 if (miit !=
847 CHKERR miit->getMeshsetIdEntitiesByDimension(moab, dimension, entities,
848 recursive);
849 } else {
850 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
851 "msId = %d is not there", msId);
852 }
854}
855
857 const int ms_id, const unsigned int cubit_bc_type, Range &entities,
858 const bool recursive) const {
859 Interface &m_field = cOre;
860 moab::Interface &moab = m_field.get_moab();
862 auto miit =
864 boost::make_tuple(ms_id, cubit_bc_type));
865 if (miit !=
867 CHKERR miit->getMeshsetIdEntitiesByDimension(moab, entities, recursive);
868 } else {
869 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
870 "ms_id = %d is not there", ms_id);
871 }
873}
874
876 const unsigned int cubit_bc_type,
877 EntityHandle &meshset) const {
878 Interface &m_field = cOre;
880 auto miit =
882 boost::make_tuple(ms_id, cubit_bc_type));
883 if (miit !=
885 meshset = miit->meshset;
886 } else {
887 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
888 "ms_id = %d is not there", ms_id);
889 }
891}
892
894 const int ms_id, const unsigned int cubit_bc_type,
895 const EntityHandle *entities, int num_entities, const int operation_type) {
896 auto miit =
898 boost::make_tuple(ms_id, cubit_bc_type));
899 if (miit !=
901 Interface &m_field = cOre;
902 return m_field.get_moab().contains_entities(miit->meshset, entities,
903 num_entities, operation_type);
904 } else
905 return false;
906}
907
909MeshsetsManager::getMeshsetsByType(const unsigned int cubit_bc_type,
910 Range &meshsets) const {
912 auto miit =
913 cubitMeshsets.get<CubitMeshsetType_mi_tag>().lower_bound(cubit_bc_type);
914 auto hi_miit =
915 cubitMeshsets.get<CubitMeshsetType_mi_tag>().upper_bound(cubit_bc_type);
916 for (; miit != hi_miit; miit++) {
917 meshsets.insert(miit->meshset);
918 }
920}
921
922struct BlockData {
923
925
926 int iD;
927 string addType;
928 string nAme;
930
931 // Materials
936
937 // BCs
944
946 std::vector<double> aTtr;
947
949 std::memcpy(dispBc.data.name, "Displacement", 12);
950 std::memcpy(forceBc.data.name, "Force", 5);
951 std::memcpy(pressureBc.data.name, "Pressure", 8);
952 std::memcpy(temperatureBc.data.name, "Temperature", 11);
953 std::memcpy(heatFluxBc.data.name, "HeatFlux", 8);
954 std::memcpy(cfgBc.data.name, "cfd_bc", 6);
955 }
956};
957
959 bool clean_file_options) {
960 Interface &m_field = cOre;
962 std::ifstream ini_file(file_name.c_str(), std::ifstream::in);
963 po::variables_map vm;
964 if (clean_file_options) {
966 boost::shared_ptr<boost::program_options::options_description>(
967 new po::options_description());
968 }
969
970 auto add_block_attributes = [&](auto prefix, auto &block_lists, auto &it) {
971 // remove spacec from blockset name
972 configFileOptionsPtr->add_options()(
973 (prefix + ".number_of_attributes").c_str(),
974 po::value<int>(&block_lists[it->getMeshsetId()].numberOfAttributes)
975 ->default_value(-1),
976 "Number of blockset attributes")(
977 (prefix + ".user_array").c_str(), po::value<string>(),
978 "Add block attributes as comma separated list");
979 for (int ii = 1; ii <= 10; ii++) {
980 std::string surfix = ".user" + boost::lexical_cast<std::string>(ii);
981 configFileOptionsPtr->add_options()(
982 (prefix + surfix).c_str(),
983 po::value<double>(&block_lists[it->getMeshsetId()].aTtr[ii - 1])
984 ->default_value(0.0),
985 "Add block attribute");
986 }
987 };
988
989 // Add blocks
990 map<int, BlockData> block_lists;
992 const auto id = it->getMeshsetId();
993 block_lists[id].cubitMeshset = it->getMeshset();
994 std::string prefix =
995 "block_" + boost::lexical_cast<std::string>(id);
996 configFileOptionsPtr->add_options()(
997 (prefix + ".add").c_str(),
998 po::value<string>(&block_lists[it->getMeshsetId()].addType)
999 ->default_value("UNKNOWNSET"),
1000 "Add block set")(
1001 (prefix + ".id").c_str(),
1002 po::value<int>(&block_lists[it->getMeshsetId()].iD)->default_value(-1),
1003 "Id of meshset")(
1004 (prefix + ".name").c_str(),
1005 po::value<string>(&block_lists[it->getMeshsetId()].nAme)
1006 ->default_value(""),
1007 "Name of the meshset");
1008
1009 // Block attributes
1010 add_block_attributes(prefix, block_lists, it);
1011
1012 // Mat elastic
1013 {
1014 // double Young; ///< Young's modulus
1015 // double Poisson; ///< Poisson's ratio
1016 // double ThermalExpansion; ///< Thermal expansion
1017 configFileOptionsPtr->add_options()(
1018 (prefix + ".young").c_str(),
1019 po::value<double>()->default_value(-1)->notifier(
1020 [&block_lists, id](double v) {
1021 block_lists[id].matElastic.data.Young = v;
1022 }),
1023 "Young modulus")(
1024 (prefix + ".poisson").c_str(),
1025 po::value<double>()->default_value(-2)->notifier(
1026 [&block_lists, id](double v) {
1027 block_lists[id].matElastic.data.Poisson = v;
1028 }),
1029 "Poisson ratio")(
1030 (prefix + ".thermalexpansion").c_str(),
1031 po::value<double>()->default_value(-1)->notifier(
1032 [&block_lists, id](double v) {
1033 block_lists[id].matElastic.data.ThermalExpansion = v;
1034 }),
1035 "Thermal expansion");
1036 // TODO Add users parameters
1037 }
1038 // Mat Trans Iso
1039 {
1040 // Young's modulus in xy plane (Ep)
1041 // Young's modulus in z-direction (Ez)
1042 // Poisson's ratio in xy plane (vp)
1043 // Poisson's ratio in z-direction (vpz)
1044 // Shear modulus in z-direction (Gzp)
1045 configFileOptionsPtr->add_options()(
1046 (prefix + ".Youngp").c_str(),
1047 po::value<double>()->default_value(-1)->notifier(
1048 [&block_lists, id](double v) {
1049 block_lists[id].matTransIso.data.Youngp = v;
1050 }),
1051 "Youngp")(
1052 (prefix + ".Youngz").c_str(),
1053 po::value<double>()->default_value(-1)->notifier(
1054 [&block_lists, id](double v) {
1055 block_lists[id].matTransIso.data.Youngz = v;
1056 }),
1057 "Youngz")(
1058 (prefix + ".Poissonp").c_str(),
1059 po::value<double>()->default_value(0)->notifier(
1060 [&block_lists, id](double v) {
1061 block_lists[id].matTransIso.data.Poissonp = v;
1062 }),
1063 "Poissonp")(
1064 (prefix + ".Poissonpz").c_str(),
1065 po::value<double>()->default_value(0)->notifier(
1066 [&block_lists, id](double v) {
1067 block_lists[id].matTransIso.data.Poissonpz = v;
1068 }),
1069 "Poissonpz")(
1070 (prefix + ".Shearzp").c_str(),
1071 po::value<double>()->default_value(-1)->notifier(
1072 [&block_lists, id](double v) {
1073 block_lists[id].matTransIso.data.Shearzp = v;
1074 }),
1075 "Shearzp");
1076 // TODO Add users parameters
1077 }
1078 // Mat thermal
1079 {
1080 // double Conductivity; ///< Thermal conductivity
1081 // double HeatCapacity; ///< Heat Capacity
1082 configFileOptionsPtr->add_options()(
1083 (prefix + ".conductivity").c_str(),
1084 po::value<double>()->default_value(-1)->notifier(
1085 [&block_lists, id](double v) {
1086 block_lists[id].matThermal.data.Conductivity = v;
1087 }),
1088 "Conductivity")(
1089 (prefix + ".capacity").c_str(),
1090 po::value<double>()->default_value(-1)->notifier(
1091 [&block_lists, id](double v) {
1092 block_lists[id].matThermal.data.HeatCapacity = v;
1093 }),
1094 "Capacity");
1095 // TODO Add users parameters
1096 }
1097 // Mat interface
1098 {
1099 // double alpha; ///< Elastic modulus multiplier
1100 // double beta; ///< Damage Coupling multiplier between normal and
1101 // shear (g=sqrt(gn^2 + beta(gt1^2 + gt2^2))) double ft; ///< Maximum
1102 // stress of crack double Gf; ///< Fracture Energy
1103 configFileOptionsPtr->add_options()(
1104 (prefix + ".interface_alpha").c_str(),
1105 po::value<double>()->default_value(-1)->notifier(
1106 [&block_lists, id](double v) {
1107 block_lists[id].matInterf.data.alpha = v;
1108 }),
1109 "alpha")((prefix + ".interface_beta").c_str(),
1110 po::value<double>()->default_value(-1)->notifier(
1111 [&block_lists, id](double v) {
1112 block_lists[id].matInterf.data.beta = v;
1113 }),
1114 "beta")(
1115 (prefix + ".interface_ft").c_str(),
1116 po::value<double>()->default_value(-1)->notifier(
1117 [&block_lists, id](double v) {
1118 block_lists[id].matInterf.data.ft = v;
1119 }),
1120 "ft")(
1121 (prefix + ".interface_Gf").c_str(),
1122 po::value<double>()->default_value(-1)->notifier(
1123 [&block_lists, id](double v) {
1124 block_lists[id].matInterf.data.Gf = v;
1125 }),
1126 "Gf");
1127 // TODO Add users parameters
1128 }
1129
1130 // Displacement bc
1131 {
1132 // char flag1; //< Flag for X-Translation (0: N/A, 1: specified)
1133 // char flag2; //< Flag for Y-Translation (0: N/A, 1: specified)
1134 // char flag3; //< Flag for Z-Translation (0: N/A, 1: specified)
1135 // char flag4; //< Flag for X-Rotation (0: N/A, 1: specified)
1136 // char flag5; //< Flag for Y-Rotation (0: N/A, 1: specified)
1137 // char flag6; //< Flag for Z-Rotation (0: N/A, 1: specified)
1138 // double value1; //< Value for X-Translation
1139 // double value2; //< Value for Y-Translation
1140 // double value3; //< Value for Z-Translation
1141 // double value4; //< Value for X-Rotation
1142 // double value5; //< Value for Y-Rotation
1143 // double value6; //< Value for Z-Rotation
1144 configFileOptionsPtr->add_options()(
1145 (prefix + ".disp_flag1").c_str(),
1146 po::value<char>()->default_value(0)->notifier(
1147 [&block_lists, id](char v) {
1148 block_lists[id].dispBc.data.flag1 = v;
1149 }),
1150 "flag1")(
1151 (prefix + ".disp_flag2").c_str(),
1152 po::value<char>()->default_value(0)->notifier(
1153 [&block_lists, id](char v) {
1154 block_lists[id].dispBc.data.flag2 = v;
1155 }),
1156 "flag2")(
1157 (prefix + ".disp_flag3").c_str(),
1158 po::value<char>()->default_value(0)->notifier(
1159 [&block_lists, id](char v) {
1160 block_lists[id].dispBc.data.flag3 = v;
1161 }),
1162 "flag3")(
1163 (prefix + ".disp_flag4").c_str(),
1164 po::value<char>()->default_value(0)->notifier(
1165 [&block_lists, id](char v) {
1166 block_lists[id].dispBc.data.flag4 = v;
1167 }),
1168 "flag4")(
1169 (prefix + ".disp_flag5").c_str(),
1170 po::value<char>()->default_value(0)->notifier(
1171 [&block_lists, id](char v) {
1172 block_lists[id].dispBc.data.flag5 = v;
1173 }),
1174 "flag5")(
1175 (prefix + ".disp_flag6").c_str(),
1176 po::value<char>()->default_value(0)->notifier(
1177 [&block_lists, id](char v) {
1178 block_lists[id].dispBc.data.flag6 = v;
1179 }),
1180 "flag6")(
1181 (prefix + ".disp_ux").c_str(),
1182 po::value<double>()->default_value(0)->notifier(
1183 [&block_lists, id](double v) {
1184 block_lists[id].dispBc.data.value1 = v;
1185 }),
1186 "value1")(
1187 (prefix + ".disp_uy").c_str(),
1188 po::value<double>()->default_value(0)->notifier(
1189 [&block_lists, id](double v) {
1190 block_lists[id].dispBc.data.value2 = v;
1191 }),
1192 "value2")(
1193 (prefix + ".disp_uz").c_str(),
1194 po::value<double>()->default_value(0)->notifier(
1195 [&block_lists, id](double v) {
1196 block_lists[id].dispBc.data.value3 = v;
1197 }),
1198 "value3")(
1199 (prefix + ".disp_rx").c_str(),
1200 po::value<double>()->default_value(0)->notifier(
1201 [&block_lists, id](double v) {
1202 block_lists[id].dispBc.data.value4 = v;
1203 }),
1204 "value4")(
1205 (prefix + ".disp_ry").c_str(),
1206 po::value<double>()->default_value(0)->notifier(
1207 [&block_lists, id](double v) {
1208 block_lists[id].dispBc.data.value5 = v;
1209 }),
1210 "value5")(
1211 (prefix + ".disp_rz").c_str(),
1212 po::value<double>()->default_value(0)->notifier(
1213 [&block_lists, id](double v) {
1214 block_lists[id].dispBc.data.value6 = v;
1215 }),
1216 "value6");
1217 }
1218 // Force BC data
1219 {
1220 // char zero[3]; //< 3 zeros
1221 // double value1; //< Force magnitude
1222 // double value2; //< Moment magnitude
1223 // double value3; //< X-component of force direction vector
1224 // double value4; //< Y-component of force direction vector
1225 // double value5; //< Z-component of force direction vector
1226 // double value6; //< X-component of moment direction vector
1227 // double value7; //< Y-component of moment direction vector
1228 // double value8; //< Z-component of moment direction vector
1229 // char zero2; // 0
1230 configFileOptionsPtr->add_options()(
1231 (prefix + ".force_magnitude").c_str(),
1232 po::value<double>()->default_value(0)->notifier(
1233 [&block_lists, id](double v) {
1234 block_lists[id].forceBc.data.value1 = v;
1235 }),
1236 "value1")((prefix + ".moment_magnitude").c_str(),
1237 po::value<double>()->default_value(0)->notifier(
1238 [&block_lists, id](double v) {
1239 block_lists[id].forceBc.data.value2 = v;
1240 }),
1241 "value2")(
1242 (prefix + ".force_fx").c_str(),
1243 po::value<double>()->default_value(0)->notifier(
1244 [&block_lists, id](double v) {
1245 block_lists[id].forceBc.data.value3 = v;
1246 }),
1247 "value3")((prefix + ".force_fy").c_str(),
1248 po::value<double>()->default_value(0)->notifier(
1249 [&block_lists, id](double v) {
1250 block_lists[id].forceBc.data.value4 = v;
1251 }),
1252 "value4")(
1253 (prefix + ".force_fz").c_str(),
1254 po::value<double>()->default_value(0)->notifier(
1255 [&block_lists, id](double v) {
1256 block_lists[id].forceBc.data.value5 = v;
1257 }),
1258 "value5")((prefix + ".moment_mx").c_str(),
1259 po::value<double>()->default_value(0)->notifier(
1260 [&block_lists, id](double v) {
1261 block_lists[id].forceBc.data.value6 = v;
1262 }),
1263 "value6")(
1264 (prefix + ".moment_my").c_str(),
1265 po::value<double>()->default_value(0)->notifier(
1266 [&block_lists, id](double v) {
1267 block_lists[id].forceBc.data.value7 = v;
1268 }),
1269 "value7")((prefix + ".moment_mz").c_str(),
1270 po::value<double>()->default_value(0)->notifier(
1271 [&block_lists, id](double v) {
1272 block_lists[id].forceBc.data.value8 = v;
1273 }),
1274 "value8");
1275 }
1276 {
1277 // char name[11]; //< 11 characters for "Temperature"
1278 // char pre1; //< This is always zero
1279 // char pre2; //< 0: temperature is not applied on thin shells
1280 // (default); 1: temperature is applied on thin shells char flag1; //<
1281 // 0: N/A, 1: temperature value applied (not on thin shells) char flag2;
1282 // //< 0: N/A, 1: temperature applied on thin shell middle char flag3;
1283 // //< 0: N/A, 1: thin shell temperature gradient specified char flag4;
1284 // //< 0: N/A, 1: top thin shell temperature char flag5; //< 0: N/A, 1:
1285 // bottom thin shell temperature char flag6; //< This is always zero
1286 // double value1; //< Temperature (default case - no thin shells)
1287 // double value2; //< Temperature for middle of thin shells
1288 // double value3; //< Temperature gradient for thin shells
1289 // double value4; //< Temperature for top of thin shells
1290 // double value5; //< Temperature for bottom of thin shells
1291 // double value6; //< This is always zero, i.e. ignore
1292 configFileOptionsPtr->add_options()(
1293 (prefix + ".temperature_flag1").c_str(),
1294 po::value<char>()->default_value(0)->notifier(
1295 [&block_lists, id](char v) {
1296 block_lists[id].temperatureBc.data.flag1 = v;
1297 }),
1298 "flag1")(
1299 (prefix + ".temperature_t").c_str(),
1300 po::value<double>()->default_value(0)->notifier(
1301 [&block_lists, id](double v) {
1302 block_lists[id].temperatureBc.data.value1 = v;
1303 }),
1304 "value1");
1305 // TODO: Add more cases, see above
1306 }
1307 // Sideset
1308 {
1309 // char name[8]; //< 8 characters for "Pressure"
1310 // char zero; //< This is always zero
1311 // char flag2; //< 0: Pressure is interpreted as pure pressure 1:
1312 // pressure is interpreted as total force double value1; //< Pressure
1313 // value
1314 configFileOptionsPtr->add_options()(
1315 (prefix + ".pressure_flag2").c_str(),
1316 po::value<char>()->default_value(0)->notifier(
1317 [&block_lists, id](char v) {
1318 block_lists[id].pressureBc.data.flag2 = v;
1319 }),
1320 "flag2")((prefix + ".pressure_magnitude").c_str(),
1321 po::value<double>()->default_value(0)->notifier(
1322 [&block_lists, id](double v) {
1323 block_lists[id].pressureBc.data.value1 = v;
1324 }),
1325 "value1");
1326 }
1327 {
1328 // char name[8]; //< 8 characters for "HeatFlux" (no space)
1329 // char pre1; //< This is always zero
1330 // char pre2; //< 0: heat flux is not applied on thin shells (default);
1331 // 1: heat flux is applied on thin shells char flag1; //< 0: N/A, 1:
1332 // normal heat flux case (i.e. single value, case without thin shells)
1333 // char flag2; //< 0: N/A, 1: Thin shell top heat flux specified
1334 // char flag3; //< 0: N/A, 1: Thin shell bottom heat flux specidied
1335 // double value1; //< Heat flux value for default case (no thin shells)
1336 // double value2; //< Heat flux (thin shell top)
1337 // double value3; //< Heat flux (thin shell bottom)
1338 configFileOptionsPtr->add_options()(
1339 (prefix + ".heatflux_flag1").c_str(),
1340 po::value<char>()->default_value(0)->notifier(
1341 [&block_lists, id](char v) {
1342 block_lists[id].heatFluxBc.data.flag1 = v;
1343 }),
1344 "flag1")((prefix + ".heatflux_magnitude").c_str(),
1345 po::value<double>()->default_value(0)->notifier(
1346 [&block_lists, id](double v) {
1347 block_lists[id].heatFluxBc.data.value1 = v;
1348 }),
1349 "value1");
1350 }
1351 // Interface set
1352 {
1353 configFileOptionsPtr->add_options()(
1354 (prefix + ".interface_type").c_str(),
1355 po::value<char>()->default_value(0)->notifier(
1356 [&block_lists, id](char v) {
1357 block_lists[id].cfgBc.data.type = v;
1358 }),
1359 "type");
1360 }
1361 }
1362
1363 map<int, BlockData> block_set_attributes;
1365 block_set_attributes[it->getMeshsetId()].cubitMeshset = it->getMeshset();
1366 block_set_attributes[it->getMeshsetId()].iD = it->getMeshsetId();
1367 block_set_attributes[it->getMeshsetId()].bcType = BLOCKSET;
1368 std::string block_name = it->getName();
1369 block_name.erase(
1370 std::remove_if(block_name.begin(), block_name.end(), ::isspace),
1371 block_name.end());
1372 block_set_attributes[it->getMeshsetId()].nAme = block_name;
1373 // Only blocks which have name
1374 if (block_name.compare("NoNameSet") != 0) {
1375 std::string prefix = "SET_ATTR_" + block_name;
1376 // Block attributes
1377 add_block_attributes(prefix, block_set_attributes, it);
1378 }
1379 }
1380
1381 po::parsed_options parsed =
1382 parse_config_file(ini_file, *configFileOptionsPtr, true);
1383 store(parsed, vm);
1384 po::notify(vm);
1385
1386 auto parse_attributes_array = [&](const std::string &option_name,
1387 const std::string &values,
1388 std::vector<double> &attributes) {
1389 attributes.clear();
1390 std::string normalized = values;
1391 for (auto &c : normalized) {
1392 if (c == ',' || c == '[' || c == ']')
1393 c = ' ';
1394 }
1395
1396 std::stringstream ss(normalized);
1397 double value;
1398 while (ss >> value) {
1399 attributes.push_back(value);
1400 }
1401 if (!ss.eof()) {
1402 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
1403 "Invalid value for %s: %s", option_name.c_str(),
1404 values.c_str());
1405 }
1406 return 0;
1407 };
1408
1409 auto apply_attributes_array = [&](const std::string &prefix,
1410 BlockData &block_data) {
1411 const auto option_name = prefix + ".user_array";
1412 if (vm.count(option_name)) {
1413 CHKERR parse_attributes_array(option_name, vm[option_name].as<string>(),
1414 block_data.aTtr);
1415 block_data.numberOfAttributes = static_cast<int>(block_data.aTtr.size());
1416 } else if (block_data.numberOfAttributes > -1) {
1417 block_data.aTtr.resize(block_data.numberOfAttributes, 0);
1418 }
1419 return 0;
1420 };
1421
1422 for (auto &block : block_lists) {
1423 const std::string prefix =
1424 "block_" + boost::lexical_cast<std::string>(block.first);
1425 CHKERR apply_attributes_array(prefix, block.second);
1426 }
1427 for (auto &set_attr : block_set_attributes) {
1428 if (set_attr.second.nAme.compare("NoNameSet") != 0) {
1429 const std::string prefix = "SET_ATTR_" + set_attr.second.nAme;
1430 CHKERR apply_attributes_array(prefix, set_attr.second);
1431 }
1432 }
1433
1434 // Set type from name
1436
1437 CubitBCType bc_type;
1438 unsigned jj = 0;
1439 while (1 << jj != LASTSET_BC) {
1440 if (string(CubitBCNames[jj + 1]) ==
1441 block_lists[it->getMeshsetId()].addType) {
1442 bc_type = 1 << jj;
1443 }
1444 ++jj;
1445 }
1446 if (bc_type.none()) {
1447 block_lists[it->getMeshsetId()].bcType = UNKNOWNSET;
1448 // Skip the bockset nothing is defined for it
1449 continue;
1450 }
1451
1452 if (bc_type.to_ulong() == BLOCKSET)
1453 block_lists[it->getMeshsetId()].bcType = BLOCKSET;
1454 else if (bc_type.to_ulong() == NODESET)
1455 block_lists[it->getMeshsetId()].bcType = NODESET;
1456 else if (bc_type.to_ulong() == SIDESET)
1457 block_lists[it->getMeshsetId()].bcType = SIDESET;
1458 else {
1459 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
1460 "Not yet implemented type %s\n",
1461 block_lists[it->getMeshsetId()].addType.c_str());
1462 }
1463 if (block_lists[it->getMeshsetId()].iD == -1) {
1464 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
1465 "Unset iD number %d\n", block_lists[it->getMeshsetId()].iD);
1466 }
1467 }
1468
1469 std::vector<std::string> additional_parameters;
1470 additional_parameters =
1471 collect_unrecognized(parsed.options, po::include_positional);
1472 for (std::vector<std::string>::iterator vit = additional_parameters.begin();
1473 vit != additional_parameters.end(); vit++) {
1474 MOFEM_LOG_C("MeshsetMngSelf", Sev::warning, "Unrecognized option %s",
1475 vit->c_str());
1476 }
1477 for (map<int, BlockData>::iterator mit = block_lists.begin();
1478 mit != block_lists.end(); mit++) {
1479 CubitMeshSet_multiIndex::iterator cubit_meshset_it =
1480 cubitMeshsets.find(mit->second.cubitMeshset);
1481 if (cubit_meshset_it == cubitMeshsets.end()) {
1482 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
1483 "Data inconsistency\n");
1484 }
1485 switch (mit->second.bcType) {
1486 case UNKNOWNSET:
1487 break;
1488 case BLOCKSET: {
1489 if ((CubitBCType(mit->second.bcType) & cubit_meshset_it->getBcType())
1490 .any() &&
1491 mit->second.iD == cubit_meshset_it->getMeshsetId()) {
1492 // Meshset is the same, only modification
1493 } else {
1494 CHKERR addMeshset(mit->second.bcType, mit->second.iD, mit->second.nAme);
1495 EntityHandle meshset = cubit_meshset_it->getMeshset();
1496 CHKERR addEntitiesToMeshset(mit->second.bcType, mit->second.iD,
1497 &meshset, 1);
1498 }
1499 // Add attributes
1500 CHKERR setAttributes(mit->second.bcType, mit->second.iD, mit->second.aTtr);
1501 // Add material elastic data if value are physical (i.e. Young > 0,
1502 // Poisson in (-1.0.5) and ThermalExpansion>0)
1503 if (mit->second.matElastic.data.Young != -1) {
1504 CHKERR setAttributesByDataStructure(mit->second.bcType, mit->second.iD,
1505 mit->second.matElastic);
1506 }
1507 if (mit->second.matTransIso.data.Youngp != -1) {
1508 CHKERR setAttributesByDataStructure(mit->second.bcType, mit->second.iD,
1509 mit->second.matTransIso);
1510 }
1511 if (mit->second.matThermal.data.Conductivity != -1) {
1512 CHKERR setAttributesByDataStructure(mit->second.bcType, mit->second.iD,
1513 mit->second.matThermal);
1514 }
1515 if (mit->second.matInterf.data.ft != -1) {
1516 CHKERR setAttributesByDataStructure(mit->second.bcType, mit->second.iD,
1517 mit->second.matInterf);
1518 }
1519 } break;
1520 case NODESET: {
1521 if ((CubitBCType(mit->second.bcType) & cubit_meshset_it->getBcType())
1522 .any() &&
1523 mit->second.iD == cubit_meshset_it->getMeshsetId()) {
1524 // Meshset is the same, only modification
1525 } else {
1526 CHKERR addMeshset(mit->second.bcType, mit->second.iD);
1527 EntityHandle meshset = cubit_meshset_it->getMeshset();
1528 CHKERR addEntitiesToMeshset(mit->second.bcType, mit->second.iD,
1529 &meshset, 1);
1530 }
1531 // Add displacement bc
1532 if (mit->second.dispBc.data.flag1 || mit->second.dispBc.data.flag2 ||
1533 mit->second.dispBc.data.flag3 || mit->second.dispBc.data.flag4 ||
1534 mit->second.dispBc.data.flag5 || mit->second.dispBc.data.flag6) {
1535 if (mit->second.dispBc.data.flag1 == '0')
1536 mit->second.dispBc.data.flag1 = 0;
1537 if (mit->second.dispBc.data.flag1 == 'N')
1538 mit->second.dispBc.data.flag1 = 0;
1539 if (mit->second.dispBc.data.flag1)
1540 mit->second.dispBc.data.flag1 = 1;
1541 if (mit->second.dispBc.data.flag2 == '0')
1542 mit->second.dispBc.data.flag2 = 0;
1543 if (mit->second.dispBc.data.flag2 == 'N')
1544 mit->second.dispBc.data.flag2 = 0;
1545 if (mit->second.dispBc.data.flag2)
1546 mit->second.dispBc.data.flag2 = 1;
1547 if (mit->second.dispBc.data.flag3 == '0')
1548 mit->second.dispBc.data.flag3 = 0;
1549 if (mit->second.dispBc.data.flag3 == 'N')
1550 mit->second.dispBc.data.flag3 = 0;
1551 if (mit->second.dispBc.data.flag3)
1552 mit->second.dispBc.data.flag3 = 1;
1553 if (mit->second.dispBc.data.flag4 == '0')
1554 mit->second.dispBc.data.flag4 = 0;
1555 if (mit->second.dispBc.data.flag4 == 'N')
1556 mit->second.dispBc.data.flag4 = 0;
1557 if (mit->second.dispBc.data.flag4)
1558 mit->second.dispBc.data.flag4 = 1;
1559 if (mit->second.dispBc.data.flag5 == '0')
1560 mit->second.dispBc.data.flag5 = 0;
1561 if (mit->second.dispBc.data.flag5 == 'N')
1562 mit->second.dispBc.data.flag5 = 0;
1563 if (mit->second.dispBc.data.flag5)
1564 mit->second.dispBc.data.flag5 = 1;
1565 if (mit->second.dispBc.data.flag6 == '0')
1566 mit->second.dispBc.data.flag6 = 0;
1567 if (mit->second.dispBc.data.flag6 == 'N')
1568 mit->second.dispBc.data.flag6 = 0;
1569 if (mit->second.dispBc.data.flag6)
1570 mit->second.dispBc.data.flag6 = 1;
1571 CHKERR setBcData(mit->second.bcType, mit->second.iD,
1572 mit->second.dispBc);
1573 }
1574 if (mit->second.forceBc.data.value1 != 0 ||
1575 mit->second.forceBc.data.value2 != 0) {
1576 CHKERR setBcData(mit->second.bcType, mit->second.iD,
1577 mit->second.forceBc);
1578 }
1579 // Add temperature boundary condition
1580 if (mit->second.temperatureBc.data.flag1) {
1581 if (mit->second.temperatureBc.data.flag1 == '0')
1582 mit->second.temperatureBc.data.flag1 = 0;
1583 if (mit->second.temperatureBc.data.flag1 == 'N')
1584 mit->second.temperatureBc.data.flag1 = 0;
1585 if (mit->second.temperatureBc.data.flag1)
1586 mit->second.temperatureBc.data.flag1 = 1;
1587 CHKERR setBcData(mit->second.bcType, mit->second.iD,
1588 mit->second.temperatureBc);
1589 }
1590 } break;
1591 case SIDESET: {
1592 if ((CubitBCType(mit->second.bcType) & cubit_meshset_it->getBcType())
1593 .any() &&
1594 mit->second.iD == cubit_meshset_it->getMeshsetId()) {
1595 // Meshset is the same, only modification
1596 } else {
1597 CHKERR addMeshset(mit->second.bcType, mit->second.iD);
1598 EntityHandle meshset = cubit_meshset_it->getMeshset();
1599 CHKERR addEntitiesToMeshset(mit->second.bcType, mit->second.iD,
1600 &meshset, 1);
1601 }
1602 // Add pressure
1603 if (mit->second.pressureBc.data.value1 != 0) {
1604 if (mit->second.pressureBc.data.flag2 == '0')
1605 mit->second.pressureBc.data.flag2 = 0;
1606 if (mit->second.pressureBc.data.flag2 == 'N')
1607 mit->second.pressureBc.data.flag2 = 0;
1608 if (mit->second.pressureBc.data.flag2)
1609 mit->second.pressureBc.data.flag2 = 1;
1610 CHKERR setBcData(mit->second.bcType, mit->second.iD,
1611 mit->second.pressureBc);
1612 }
1613 // Add heat flux
1614 if (mit->second.heatFluxBc.data.value1 != 0) {
1615 if (mit->second.heatFluxBc.data.flag1 == '0')
1616 mit->second.heatFluxBc.data.flag1 = 0;
1617 if (mit->second.heatFluxBc.data.flag1 == 'N')
1618 mit->second.heatFluxBc.data.flag1 = 0;
1619 if (mit->second.heatFluxBc.data.flag1)
1620 mit->second.heatFluxBc.data.flag1 = 1;
1621 CHKERR setBcData(mit->second.bcType, mit->second.iD,
1622 mit->second.heatFluxBc);
1623 }
1624 // Add Interface
1625 if (mit->second.cfgBc.data.type != 0) {
1626 CHKERR setBcData(mit->second.bcType, mit->second.iD, mit->second.cfgBc);
1627 }
1628 } break;
1629 default:
1630 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
1631 "Not yet implemented type\n");
1632 }
1633 }
1634
1635 for (auto set_attr : block_set_attributes) {
1636 // Add attributes
1637 if (set_attr.second.numberOfAttributes > 0) {
1638 MOFEM_LOG("MeshsetMngSelf", Sev::verbose)
1639 << "Set attributes to blockset " << set_attr.second.nAme;
1640 set_attr.second.aTtr.resize(set_attr.second.numberOfAttributes);
1641 CHKERR setAttributes(set_attr.second.bcType, set_attr.second.iD,
1642 set_attr.second.aTtr);
1643 }
1644 }
1645
1647}
1648
1650 Interface &m_field = cOre;
1651 PetscBool flg_file;
1652 char meshset_file_name[255] = "config_file.cfg";
1654 PetscOptionsBegin(m_field.get_comm(), "", "Set meshsets form file",
1655 "none");
1656 CHKERR PetscOptionsString("-meshsets_config", "meshsets config file name",
1657 "", "add_cubit_meshsets.in", meshset_file_name, 255,
1658 &flg_file);
1659 auto *json_config = m_field.getInterface<JsonConfigManager>();
1660 if (flg_file == PETSC_TRUE) {
1661 ifstream f(meshset_file_name);
1662 if (!f.good()) {
1663 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
1664 "File configuring meshsets ( %s ) can not be open\n",
1665 meshset_file_name);
1666 }
1667 CHKERR setMeshsetFromFile(string(meshset_file_name));
1668 MOFEM_LOG("MeshsetMngWorld", Sev::inform)
1669 << "Printing all meshsets (old and added from meshsets "
1670 "configurational file)";
1671 for (auto cit = getBegin(); cit != getEnd(); cit++) {
1672 MOFEM_LOG("MeshsetMngWorld", Sev::inform) << *cit;
1673 }
1674 } else if (json_config->hasMeshsetsSection()) {
1675 CHKERR json_config->applyMeshsets();
1676 }
1677 PetscOptionsEnd();
1679}
1680
1682 const int ms_id, const unsigned int cubit_bc_type,
1683 const std::string file_name, const std::string file_type,
1684 const std::string options) const {
1685
1687 MoFEM::Interface &m_field = cOre;
1688 const CubitMeshSets *cubit_meshset_ptr;
1689 CHKERR getCubitMeshsetPtr(ms_id, cubit_bc_type, &cubit_meshset_ptr);
1690 EntityHandle meshset = cubit_meshset_ptr->getMeshset();
1691 CHKERR m_field.get_moab().write_file(file_name.c_str(), file_type.c_str(),
1692 options.c_str(), &meshset, 1);
1694}
1695
1697 const int ms_id, const unsigned int cubit_bc_type, const int dim,
1698 const std::string file_name, const bool recursive,
1699 const std::string file_type, const std::string options) const {
1700
1702 MoFEM::Interface &m_field = cOre;
1703 moab::Interface &moab = m_field.get_moab();
1704 Range entities;
1705 CHKERR getEntitiesByDimension(ms_id, cubit_bc_type, dim, entities, recursive);
1706 EntityHandle meshset;
1707 CHKERR moab.create_meshset(MESHSET_SET, meshset);
1708 CHKERR moab.add_entities(meshset, entities);
1709 CHKERR moab.write_file(file_name.c_str(), file_type.c_str(), options.c_str(),
1710 &meshset, 1);
1711 CHKERR moab.delete_entities(&meshset, 1);
1713}
1714
1719 for (_IT_CUBITMESHSETS_FOR_LOOP_((*this), iit)) {
1720 EntityHandle meshset = iit->getMeshset();
1721 for (EntityType t = MBVERTEX; t != MBENTITYSET; ++t)
1722 CHKERR bit_mng->updateMeshsetByEntitiesChildren(meshset, bit, meshset, t,
1723 true);
1724 }
1726}
1727
1728} // namespace MoFEM
#define MOFEM_LOG_SEVERITY_SYNC(comm, severity)
Synchronise "SYNC" on curtain severity level.
#define MOFEM_LOG_C(channel, severity, format,...)
constexpr double a
MoFEMTypes
Those types control how functions respond on arguments, f.e. error handling.
@ MF_EXIST
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MYPCOMM_INDEX
default communicator number PCOMM
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
CubitBC
Types of sets and boundary conditions.
@ MAT_ELASTICSET
block name is "MAT_ELASTIC"
@ NODESET
@ SIDESET
@ LASTSET_BC
@ MAT_THERMALSET
block name is "MAT_THERMAL"
@ MAT_MOISTURESET
block name is "MAT_MOISTURE"
@ UNKNOWNSET
@ BLOCKSET
@ MOFEM_OPERATION_UNSUCCESSFUL
Definition definitions.h:34
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
static const char *const CubitBCNames[]
Names of types of sets and boundary conditions.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
MoFEMErrorCode deleteMeshset(const CubitBCType cubit_bc_type, const int ms_id, const MoFEMTypes bh=MF_EXIST)
delete cubit meshset
MoFEMErrorCode updateMeshsetByEntitiesChildren(const EntityHandle parent, const BitRefLevel parent_bit, const BitRefLevel parent_mask, const BitRefLevel child_bit, const BitRefLevel child_mask, const EntityHandle child, EntityType child_type, const bool recursive=false, int verb=0)
Get child entities form meshset containing parent entities.
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
#define MOFEM_LOG(channel, severity)
Log.
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
MoFEMErrorCode printForceSet() const
Print meshsets with force boundary conditions.
MoFEMErrorCode getMeshset(const int ms_id, const unsigned int cubit_bc_type, EntityHandle &meshset) const
get meshset from CUBIT Id and CUBIT type
MoFEMErrorCode setBcData(const CubitBCType cubit_bc_type, const int ms_id, const GenericCubitBcData &data)
Set boundary condition data for meshset.
MoFEMErrorCode broadcastMeshsets(int verb=DEFAULT_VERBOSITY)
Broadcast meshsets across MPI processes.
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=DEFAULT_VERBOSITY)
Initialize container from mesh data.
MoFEMErrorCode clearMap()
Clear the multi-index container.
MoFEMErrorCode setAttributes(const CubitBCType cubit_bc_type, const int ms_id, const std::vector< double > &attributes, const std::string name="")
Set attributes for CUBIT meshset.
MoFEMErrorCode addEntitiesToMeshset(const CubitBCType cubit_bc_type, const int ms_id, const Range &ents)
Add entities to CUBIT meshset.
bool checkMeshset(const int ms_id, const CubitBCType cubit_bc_type) const
Check for CUBIT meshset by ID and type.
MoFEMErrorCode discardBlocksetConfiguration(std::size_t *cleared_names=nullptr, std::size_t *cleared_attributes=nullptr, const bool clear_names=true, const bool clear_attributes=true)
Remove imported BLOCKSET names and/or attributes from the mesh.
CubitMeshSet_multiIndex::iterator getBegin() const
get begin iterator of cubit meshset 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.
MoFEMErrorCode printPressureSet() const
Print meshsets with pressure boundary conditions.
MoFEMErrorCode printMaterialsSet() const
Print meshsets with material properties.
MoFEMErrorCode setMeshsetFromFile()
Load meshset configuration from command line specified file.
MoFEMErrorCode addMeshset(const CubitBCType cubit_bc_type, const int ms_id, const std::string name="")
Add CUBIT meshset to manager.
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
#define _IT_CUBITMESHSETS_FOR_LOOP_(MESHSET_MANAGER, IT)
Iterator that loops over all the Cubit MeshSets in a moFEM field.
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
MoFEMErrorCode readMeshsets(int verb=DEFAULT_VERBOSITY)
Read meshsets from mesh database.
MoFEMErrorCode printHeatFluxSet() const
Print meshsets with heat flux boundary conditions.
MoFEMErrorCode printTemperatureSet() const
Print meshsets with temperature boundary conditions.
MoFEMErrorCode getTags(int verb=-1)
Get tag handles used on meshsets.
MoFEMErrorCode setAttributesByDataStructure(const CubitBCType cubit_bc_type, const int ms_id, const GenericAttributeData &data, const std::string name="")
Set attributes using data structure.
MoFEMErrorCode printDisplacementSet() const
Print meshsets with displacement boundary conditions.
CubitMeshSet_multiIndex::iterator getEnd() const
get begin iterator of cubit meshset of given type (instead you can use IT_CUBITMESHSETS_TYPE_FOR_LOOP...
#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.
auto bit
set bit
FTensor::Index< 'i', SPACE_DIM > i
const double c
speed of light (cm/ns)
const double v
phase velocity of light in medium (cm/ns)
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< 32 > CubitBCType
Definition Types.hpp:52
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition Types.hpp:40
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
constexpr double t
plate stiffness
Definition plate.cpp:58
FTensor::Index< 'm', 3 > m
Managing BitRefLevels.
PressureCubitBcData pressureBc
CfgCubitBcData cfgBc
Mat_Elastic_TransIso matTransIso
HeatFluxCubitBcData heatFluxBc
DisplacementCubitBcData dispBc
ForceCubitBcData forceBc
std::vector< double > aTtr
TemperatureCubitBcData temperatureBc
EntityHandle cubitMeshset
Definition of the cfd_bc data structure.
Definition BCData.hpp:476
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
Core (interface) class.
Definition Core.hpp:83
this struct keeps basic methods for moab meshset about material and boundary conditions
unsigned long int getMaskedBcTypeULong() const
get meshset type and mask
EntityHandle getMeshset() const
get bc meshset
int getMeshsetId() const
get meshset id as it set in preprocessing software
MultiIndex Tag for field id.
Deprecated interface functions.
Definition of the displacement bc data structure.
Definition BCData.hpp:72
Definition of the force bc data structure.
Definition BCData.hpp:135
Generic attribute data structure.
Generic bc data structure.
Definition BCData.hpp:16
const CubitBCType tYpe
Type of boundary condition.
Definition BCData.hpp:55
Definition of the heat flux bc data structure.
Definition BCData.hpp:423
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
static boost::shared_ptr< std::ostream > getStrmSync()
Get the strm sync object.
static bool checkIfChannelExist(const std::string channel)
Check if channel exist.
static boost::shared_ptr< std::ostream > getStrmSelf()
Get the strm self object.
Transverse Isotropic material data structure.
Elastic material data structure.
Linear interface data structure.
moisture transport material data structure
Thermal material data structure.
Interface for managing meshsets containing materials and boundary conditions.
MeshsetsManager(const MoFEM::Core &core)
Constructor for MeshsetsManager.
MoFEMErrorCode addBitToMeshsetType(const CubitBCType cubit_bc_type, const int ms_id, const CubitBCType type_bit)
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
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.
static void sortMeshsets(std::vector< const CubitMeshSets * > &vec_ptr)
MoFEMErrorCode setName(const CubitBCType cubit_bc_type, const int ms_id, const std::string &name)
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Query interface for MeshsetsManager.
MoFEMErrorCode updateAllMeshsetsByEntitiesChildren(const BitRefLevel &bit)
Update all blocksets, sidesets and node sets.
MoFEMErrorCode printBcSet(CUBIT_BC_DATA_TYPE &data, unsigned long int type) const
CubitMeshSet_multiIndex cubitMeshsets
cubit meshsets
MoFEM::Core & cOre
Reference to MoFEM Core interface.
boost::shared_ptr< boost::program_options::options_description > configFileOptionsPtr
config file options
Definition of the pressure bc data structure.
Definition BCData.hpp:375
Definition of the temperature bc data structure.
Definition BCData.hpp:302
base class for all interface classes
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.