10namespace po = boost::program_options;
24 : cOre(const_cast<
Core &>(core)) {
27 auto core_log = logging::core::get();
45 MOFEM_LOG(
"MeshsetMngWorld", Sev::noisy) <<
"Mashset manager created";
61 std::vector<const CubitMeshSets *> vec_ptr;
64 vec_ptr.push_back(&
m);
66 std::sort(vec_ptr.begin(), vec_ptr.end(),
68 return a->getMeshsetId() < b->getMeshsetId();
71 for (
auto m_ptr : vec_ptr) {
72 MOFEM_LOG(
"MeshsetMngWorld", Sev::inform) << *m_ptr;
75 for (
auto m_ptr : vec_ptr) {
76 MOFEM_LOG(
"MeshsetMngSync", Sev::verbose) << *m_ptr;
85 moab::Interface &moab = m_field.
get_moab();
89 CHKERR moab.get_entities_by_type(0, MBENTITYSET, meshsets,
false);
90 for (
auto m : meshsets) {
97 "meshset not inserted");
98 MOFEM_LOG(
"MeshsetMngSelf", Sev::noisy) <<
"read " << block;
107 moab::Interface &moab = m_field.
get_moab();
110 ParallelComm *pcomm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
113 "MOAB communicator not set");
115 const double coords[] = {0, 0, 0};
117 auto set_tags_dummy_node = [&](
const EntityHandle dummy_node,
120 std::vector<Tag> tag_handles;
121 CHKERR moab.tag_get_tags_on_entity(meshset, tag_handles);
122 for (
auto th : tag_handles) {
125 CHKERR moab.tag_get_by_ptr(
th, &meshset, 1, (
const void **)data,
127 CHKERR moab.tag_set_by_ptr(
th, &dummy_node, 1, data, &tag_size);
132 for (
int from_proc = 0; from_proc < pcomm->size(); ++from_proc) {
136 if (from_proc == pcomm->rank()) {
137 std::vector<EntityHandle> dummy_nodes(
cubitMeshsets.size(), 0);
140 CHKERR moab.create_vertex(coords, dummy_nodes[
i]);
141 CHKERR set_tags_dummy_node(dummy_nodes[
i],
m.getMeshset());
144 r_dummy_nodes.insert_list(dummy_nodes.begin(), dummy_nodes.end());
147 CHKERR pcomm->broadcast_entities(from_proc, r_dummy_nodes,
false,
true);
149 for (
auto dummy_node : r_dummy_nodes) {
151 CHKERR moab.create_meshset(MESHSET_SET,
m);
152 CHKERR set_tags_dummy_node(
m, dummy_node);
160 CHKERR moab.delete_entities(&
m, 1);
163 <<
"broadcast " << broadcast_block;
168 CHKERR moab.delete_entities(r_dummy_nodes);
177 moab::Interface &moab = m_field.
get_moab();
178 int default_val = -1;
179 CHKERR moab.tag_get_handle(DIRICHLET_SET_TAG_NAME, 1, MB_TYPE_INTEGER,
nsTag,
180 MB_TAG_SPARSE | MB_TAG_CREAT, &default_val);
182 CHKERR moab.tag_get_handle(NEUMANN_SET_TAG_NAME, 1, MB_TYPE_INTEGER,
ssTag,
183 MB_TAG_SPARSE | MB_TAG_CREAT, &default_val);
185 const int def_bc_data_len = 0;
186 std::string tag_name = std::string(DIRICHLET_SET_TAG_NAME) +
"__BC_DATA";
187 CHKERR moab.tag_get_handle(
188 tag_name.c_str(), def_bc_data_len, MB_TYPE_OPAQUE,
nsTag_data,
189 MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES | MB_TAG_VARLEN, NULL);
191 tag_name = std::string(NEUMANN_SET_TAG_NAME) +
"__BC_DATA";
192 CHKERR moab.tag_get_handle(
193 tag_name.c_str(), def_bc_data_len, MB_TYPE_OPAQUE,
ssTag_data,
194 MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES | MB_TAG_VARLEN, NULL);
196 CHKERR moab.tag_get_handle(MATERIAL_SET_TAG_NAME, 1, MB_TYPE_INTEGER,
bhTag,
197 MB_TAG_SPARSE | MB_TAG_CREAT, &default_val);
199 std::vector<unsigned int> def_uint_zero(3, 0);
200 CHKERR moab.tag_get_handle(
201 BLOCK_HEADER, 3 *
sizeof(
unsigned int), MB_TYPE_INTEGER,
bhTag_header,
202 MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_BYTES, &def_uint_zero[0]);
205 int def_Block_Attributes_length = 0;
206 CHKERR moab.tag_get_handle(
207 BLOCK_ATTRIBUTES, def_Block_Attributes_length, MB_TYPE_DOUBLE,
208 block_attribs, MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_VARLEN, NULL);
211 CHKERR moab.tag_get_handle(NAME_TAG_NAME, NAME_TAG_SIZE, MB_TYPE_OPAQUE,
212 entity_name_tag, MB_TAG_SPARSE | MB_TAG_CREAT);
255 const moab::Interface &moab = m_field.
get_moab();
259 CHKERR it->getAttributeDataStructure(data);
260 MOFEM_LOG(
"MeshsetMngWorld", Sev::inform) << *it;
261 MOFEM_LOG(
"MeshsetMngWorld", Sev::inform) << data;
263 CHKERR moab.get_entities_by_dimension(it->meshset, 3, tets,
true);
264 MOFEM_LOG(
"MeshsetMngWorld", Sev::inform)
265 <<
"MAT_ELATIC msId " << it->getMeshsetId() <<
" nb. volumes "
272 CHKERR it->getAttributeDataStructure(data);
273 MOFEM_LOG(
"MeshsetMngWorld", Sev::inform) << *it;
274 MOFEM_LOG(
"MeshsetMngWorld", Sev::inform) << data;
280 CHKERR it->getAttributeDataStructure(data);
281 MOFEM_LOG(
"MeshsetMngWorld", Sev::inform) << *it;
282 MOFEM_LOG(
"MeshsetMngWorld", Sev::inform) << data;
291 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
300 int *
const number_of_meshsets_ptr)
const {
303 if (std::distance(miit, hi_miit) == 0) {
306 if (number_of_meshsets_ptr) {
307 *number_of_meshsets_ptr = std::distance(miit, hi_miit);
314 const std::string name) {
316 moab::Interface &moab = m_field.
get_moab();
320 "such cubit meshset is already there", ms_id);
329 "meshset not inserted");
331 if (name.size() > 0) {
336 "name to cubit meshset can not be set");
346 const int ms_id,
const Range &ents) {
348 moab::Interface &moab = m_field.
get_moab();
352 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
356 "Cannot find Cubit meshset with id: %d", ms_id);
359 CHKERR moab.add_entities(meshset, ents);
369 moab::Interface &moab = m_field.
get_moab();
373 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
377 "Cannot find Cubit meshset with id: %d", ms_id);
380 CHKERR moab.add_entities(meshset, ents, nb_ents);
387 const std::vector<double> &attributes,
388 const std::string name) {
390 moab::Interface &moab = m_field.
get_moab();
394 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
398 "Cannot find Cubit meshset with id: %d", ms_id);
400 if (name.size() > 0) {
405 "name to cubit meshset can not be set");
413 "modification unsuccessful");
415 std::ostringstream ss;
416 ss <<
"Block " << cit->getName();
418 for (
unsigned int ii = 0; ii != attributes.size(); ii++) {
419 ss << attributes[ii] <<
" ";
421 MOFEM_LOG(
"MeshsetMngSelf", Sev::noisy) << ss.str();
430 moab::Interface &moab = m_field.
get_moab();
434 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
438 "Cannot find Cubit meshset with id: %d", ms_id);
440 if (name.size() > 0) {
445 "name to cubit meshset can not be set");
453 "modification unsuccessful");
461 moab::Interface &moab = m_field.
get_moab();
465 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
469 "Cubit meshset with id is already there", ms_id);
476 "modification unsuccessful");
484 moab::Interface &moab = m_field.
get_moab();
488 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
493 "meshset not found", ms_id);
500 CHKERR moab.delete_entities(&meshset, 1);
512 boost::make_tuple(ms_id, cubit_bc_type.to_ulong()));
515 *cubit_meshset_ptr = &*miit;
518 "msId = %d is not there", ms_id);
529 "Get not get meshset");
530 return cubit_meshset_ptr;
534 const string name,
const CubitMeshSets **cubit_meshset_ptr)
const {
539 if (std::distance(miit, hi_miit) == 0) {
541 "meshset name <%s> is not there", name.c_str());
543 if (std::distance(miit, hi_miit) > 1) {
545 "more that one meshser of that name <%s>", name.c_str());
547 *cubit_meshset_ptr = &*miit;
553 std::vector<const CubitMeshSets *> &vec_ptr)
const {
556 if ((
c.getBcType() & cubit_bc_type) == cubit_bc_type) {
557 vec_ptr.push_back(&
c);
560 std::sort(vec_ptr.begin(), vec_ptr.end(),
562 return a->getMeshsetId() < b->getMeshsetId();
568std::vector<const CubitMeshSets *>
570 std::vector<const CubitMeshSets *> vec_ptr;
572 "Error in getting meshsets by name");
577 const std::regex reg_exp_name,
578 std::vector<const CubitMeshSets *> &vec_ptr)
const {
582 for (; r.first != r.second; ++r.first) {
583 const auto name = r.first->getName();
584 if (std::regex_match(name, reg_exp_name)) {
585 vec_ptr.push_back(&*r.first);
588 std::sort(vec_ptr.begin(), vec_ptr.end(),
590 return a->getMeshsetId() < b->getMeshsetId();
595std::vector<const CubitMeshSets *>
597 std::vector<const CubitMeshSets *> vec_ptr;
599 "Error in getting meshsets by name");
604 const int msId,
const unsigned int cubit_bc_type,
const int dimension,
605 Range &entities,
const bool recursive)
const {
607 moab::Interface &moab = m_field.
get_moab();
611 boost::make_tuple(msId, cubit_bc_type));
614 CHKERR miit->getMeshsetIdEntitiesByDimension(moab, dimension, entities,
618 "msId = %d is not there", msId);
624 const int ms_id,
const unsigned int cubit_bc_type,
Range &entities,
625 const bool recursive)
const {
627 moab::Interface &moab = m_field.
get_moab();
631 boost::make_tuple(ms_id, cubit_bc_type));
634 CHKERR miit->getMeshsetIdEntitiesByDimension(moab, entities, recursive);
637 "ms_id = %d is not there", ms_id);
643 const unsigned int cubit_bc_type,
649 boost::make_tuple(ms_id, cubit_bc_type));
652 meshset = miit->meshset;
655 "ms_id = %d is not there", ms_id);
661 const int ms_id,
const unsigned int cubit_bc_type,
662 const EntityHandle *entities,
int num_entities,
const int operation_type) {
665 boost::make_tuple(ms_id, cubit_bc_type));
669 return m_field.
get_moab().contains_entities(miit->meshset, entities,
670 num_entities, operation_type);
677 Range &meshsets)
const {
683 for (; miit != hi_miit; miit++) {
684 meshsets.insert(miit->meshset);
716 std::memcpy(
dispBc.
data.name,
"Displacement", 12);
721 std::memcpy(
cfgBc.
data.name,
"cfd_bc", 6);
726 bool clean_file_options) {
729 std::ifstream ini_file(file_name.c_str(), std::ifstream::in);
730 po::variables_map vm;
731 if (clean_file_options) {
733 boost::shared_ptr<boost::program_options::options_description>(
734 new po::options_description());
737 auto add_block_attributes = [&](
auto prefix,
auto &block_lists,
auto &it) {
740 (prefix +
".number_of_attributes").c_str(),
741 po::value<int>(&block_lists[it->getMeshsetId()].numberOfAttributes)
743 "Number of blockset attribute");
744 for (
int ii = 1; ii <= 10; ii++) {
745 std::string surfix =
".user" + boost::lexical_cast<std::string>(ii);
747 (prefix + surfix).c_str(),
748 po::value<double>(&block_lists[it->getMeshsetId()].aTtr[ii - 1])
749 ->default_value(0.0),
750 "Add block attribute");
755 map<int, BlockData> block_lists;
757 block_lists[it->getMeshsetId()].cubitMeshset = it->getMeshset();
759 "block_" + boost::lexical_cast<std::string>(it->getMeshsetId());
761 (prefix +
".add").c_str(),
762 po::value<string>(&block_lists[it->getMeshsetId()].addType)
763 ->default_value(
"UNKNOWNSET"),
765 (prefix +
".id").c_str(),
766 po::value<int>(&block_lists[it->getMeshsetId()].iD)->default_value(-1),
768 (prefix +
".name").c_str(),
769 po::value<string>(&block_lists[it->getMeshsetId()].nAme)
771 "Name of the meshset");
774 add_block_attributes(prefix, block_lists, it);
782 (prefix +
".young").c_str(),
784 &block_lists[it->getMeshsetId()].matElastic.data.Young)
787 (prefix +
".poisson").c_str(),
789 &block_lists[it->getMeshsetId()].matElastic.data.Poisson)
792 (prefix +
".thermalexpansion").c_str(),
794 &block_lists[it->getMeshsetId()].matElastic.data.ThermalExpansion)
796 "Thermal expansion");
807 (prefix +
".Youngp").c_str(),
809 &block_lists[it->getMeshsetId()].matTransIso.data.Youngp)
812 (prefix +
".Youngz").c_str(),
814 &block_lists[it->getMeshsetId()].matTransIso.data.Youngz)
817 (prefix +
".Poissonp").c_str(),
819 &block_lists[it->getMeshsetId()].matTransIso.data.Poissonp)
822 (prefix +
".Poissonpz").c_str(),
824 &block_lists[it->getMeshsetId()].matTransIso.data.Poissonpz)
827 (prefix +
".Shearzp").c_str(),
829 &block_lists[it->getMeshsetId()].matTransIso.data.Shearzp)
839 (prefix +
".conductivity").c_str(),
841 &block_lists[it->getMeshsetId()].matThermal.data.Conductivity)
844 (prefix +
".capacity").c_str(),
846 &block_lists[it->getMeshsetId()].matThermal.data.HeatCapacity)
858 (prefix +
".interface_alpha").c_str(),
860 &block_lists[it->getMeshsetId()].matInterf.data.alpha)
862 "alpha")((prefix +
".interface_beta").c_str(),
864 &block_lists[it->getMeshsetId()].matInterf.data.beta)
867 (prefix +
".interface_ft").c_str(),
868 po::value<double>(&block_lists[it->getMeshsetId()].matInterf.data.ft)
871 (prefix +
".interface_Gf").c_str(),
872 po::value<double>(&block_lists[it->getMeshsetId()].matInterf.data.Gf)
893 (prefix +
".disp_flag1").c_str(),
894 po::value<char>(&block_lists[it->getMeshsetId()].dispBc.data.flag1)
897 (prefix +
".disp_flag2").c_str(),
898 po::value<char>(&block_lists[it->getMeshsetId()].dispBc.data.flag2)
901 (prefix +
".disp_flag3").c_str(),
902 po::value<char>(&block_lists[it->getMeshsetId()].dispBc.data.flag3)
905 (prefix +
".disp_flag4").c_str(),
906 po::value<char>(&block_lists[it->getMeshsetId()].dispBc.data.flag4)
909 (prefix +
".disp_flag5").c_str(),
910 po::value<char>(&block_lists[it->getMeshsetId()].dispBc.data.flag5)
913 (prefix +
".disp_flag6").c_str(),
914 po::value<char>(&block_lists[it->getMeshsetId()].dispBc.data.flag6)
917 (prefix +
".disp_ux").c_str(),
918 po::value<double>(&block_lists[it->getMeshsetId()].dispBc.data.value1)
921 (prefix +
".disp_uy").c_str(),
922 po::value<double>(&block_lists[it->getMeshsetId()].dispBc.data.value2)
925 (prefix +
".disp_uz").c_str(),
926 po::value<double>(&block_lists[it->getMeshsetId()].dispBc.data.value3)
929 (prefix +
".disp_rx").c_str(),
930 po::value<double>(&block_lists[it->getMeshsetId()].dispBc.data.value4)
933 (prefix +
".disp_ry").c_str(),
934 po::value<double>(&block_lists[it->getMeshsetId()].dispBc.data.value5)
937 (prefix +
".disp_rz").c_str(),
938 po::value<double>(&block_lists[it->getMeshsetId()].dispBc.data.value6)
955 (prefix +
".force_magnitude").c_str(),
957 &block_lists[it->getMeshsetId()].forceBc.data.value1)
959 "value1")((prefix +
".moment_magnitude").c_str(),
961 &block_lists[it->getMeshsetId()].forceBc.data.value2)
964 (prefix +
".force_fx").c_str(),
966 &block_lists[it->getMeshsetId()].forceBc.data.value3)
968 "value3")((prefix +
".force_fy").c_str(),
970 &block_lists[it->getMeshsetId()].forceBc.data.value4)
973 (prefix +
".force_fz").c_str(),
975 &block_lists[it->getMeshsetId()].forceBc.data.value5)
977 "value5")((prefix +
".moment_mx").c_str(),
979 &block_lists[it->getMeshsetId()].forceBc.data.value6)
982 (prefix +
".moment_my").c_str(),
984 &block_lists[it->getMeshsetId()].forceBc.data.value7)
986 "value7")((prefix +
".moment_mz").c_str(),
988 &block_lists[it->getMeshsetId()].forceBc.data.value8)
1009 (prefix +
".temperature_flag1").c_str(),
1011 &block_lists[it->getMeshsetId()].temperatureBc.data.flag1)
1014 (prefix +
".temperature_t").c_str(),
1016 &block_lists[it->getMeshsetId()].temperatureBc.data.value1)
1029 (prefix +
".pressure_flag2").c_str(),
1031 &block_lists[it->getMeshsetId()].pressureBc.data.flag2)
1033 "flag2")((prefix +
".pressure_magnitude").c_str(),
1035 &block_lists[it->getMeshsetId()].pressureBc.data.value1)
1051 (prefix +
".heatflux_flag1").c_str(),
1053 &block_lists[it->getMeshsetId()].heatFluxBc.data.flag1)
1055 "flag1")((prefix +
".heatflux_magnitude").c_str(),
1057 &block_lists[it->getMeshsetId()].heatFluxBc.data.value1)
1064 (prefix +
".interface_type").c_str(),
1065 po::value<char>(&block_lists[it->getMeshsetId()].cfgBc.data.type)
1071 map<int, BlockData> block_set_attributes;
1073 block_set_attributes[it->getMeshsetId()].cubitMeshset = it->getMeshset();
1074 block_set_attributes[it->getMeshsetId()].iD = it->getMeshsetId();
1075 block_set_attributes[it->getMeshsetId()].bcType =
BLOCKSET;
1076 std::string block_name = it->getName();
1078 std::remove_if(block_name.begin(), block_name.end(), ::isspace),
1080 block_set_attributes[it->getMeshsetId()].nAme = block_name;
1082 if (block_name.compare(
"NoNameSet") != 0) {
1083 std::string prefix =
"SET_ATTR_" + block_name;
1085 add_block_attributes(prefix, block_set_attributes, it);
1089 po::parsed_options parsed =
1101 block_lists[it->getMeshsetId()].addType) {
1106 if (bc_type.none()) {
1107 block_lists[it->getMeshsetId()].bcType =
UNKNOWNSET;
1112 if (bc_type.to_ulong() ==
BLOCKSET)
1113 block_lists[it->getMeshsetId()].bcType =
BLOCKSET;
1114 else if (bc_type.to_ulong() ==
NODESET)
1115 block_lists[it->getMeshsetId()].bcType =
NODESET;
1116 else if (bc_type.to_ulong() ==
SIDESET)
1117 block_lists[it->getMeshsetId()].bcType =
SIDESET;
1120 "Not yet implemented type %s\n",
1121 block_lists[it->getMeshsetId()].addType.c_str());
1123 if (block_lists[it->getMeshsetId()].iD == -1) {
1125 "Unset iD number %d\n", block_lists[it->getMeshsetId()].iD);
1129 std::vector<std::string> additional_parameters;
1130 additional_parameters =
1131 collect_unrecognized(parsed.options, po::include_positional);
1132 for (std::vector<std::string>::iterator vit = additional_parameters.begin();
1133 vit != additional_parameters.end(); vit++) {
1134 MOFEM_LOG_C(
"MeshsetMngSelf", Sev::warning,
"Unrecognized option %s",
1137 for (map<int, BlockData>::iterator mit = block_lists.begin();
1138 mit != block_lists.end(); mit++) {
1139 CubitMeshSet_multiIndex::iterator cubit_meshset_it =
1143 "Data inconsistency\n");
1145 switch (mit->second.bcType) {
1149 if ((
CubitBCType(mit->second.bcType) & cubit_meshset_it->getBcType())
1151 mit->second.iD == cubit_meshset_it->getMeshsetId()) {
1163 if (mit->second.matElastic.data.Young != -1) {
1165 mit->second.matElastic);
1167 if (mit->second.matTransIso.data.Youngp != -1) {
1169 mit->second.matTransIso);
1171 if (mit->second.matThermal.data.Conductivity != -1) {
1173 mit->second.matThermal);
1175 if (mit->second.matInterf.data.ft != -1) {
1177 mit->second.matInterf);
1181 if ((
CubitBCType(mit->second.bcType) & cubit_meshset_it->getBcType())
1183 mit->second.iD == cubit_meshset_it->getMeshsetId()) {
1192 if (mit->second.dispBc.data.flag1 || mit->second.dispBc.data.flag2 ||
1193 mit->second.dispBc.data.flag3 || mit->second.dispBc.data.flag4 ||
1194 mit->second.dispBc.data.flag5 || mit->second.dispBc.data.flag6) {
1195 if (mit->second.dispBc.data.flag1 ==
'0')
1196 mit->second.dispBc.data.flag1 = 0;
1197 if (mit->second.dispBc.data.flag1 ==
'N')
1198 mit->second.dispBc.data.flag1 = 0;
1199 if (mit->second.dispBc.data.flag1)
1200 mit->second.dispBc.data.flag1 = 1;
1201 if (mit->second.dispBc.data.flag2 ==
'0')
1202 mit->second.dispBc.data.flag2 = 0;
1203 if (mit->second.dispBc.data.flag2 ==
'N')
1204 mit->second.dispBc.data.flag2 = 0;
1205 if (mit->second.dispBc.data.flag2)
1206 mit->second.dispBc.data.flag2 = 1;
1207 if (mit->second.dispBc.data.flag3 ==
'0')
1208 mit->second.dispBc.data.flag3 = 0;
1209 if (mit->second.dispBc.data.flag3 ==
'N')
1210 mit->second.dispBc.data.flag3 = 0;
1211 if (mit->second.dispBc.data.flag3)
1212 mit->second.dispBc.data.flag3 = 1;
1213 if (mit->second.dispBc.data.flag4 ==
'0')
1214 mit->second.dispBc.data.flag4 = 0;
1215 if (mit->second.dispBc.data.flag4 ==
'N')
1216 mit->second.dispBc.data.flag4 = 0;
1217 if (mit->second.dispBc.data.flag4)
1218 mit->second.dispBc.data.flag4 = 1;
1219 if (mit->second.dispBc.data.flag5 ==
'0')
1220 mit->second.dispBc.data.flag5 = 0;
1221 if (mit->second.dispBc.data.flag5 ==
'N')
1222 mit->second.dispBc.data.flag5 = 0;
1223 if (mit->second.dispBc.data.flag5)
1224 mit->second.dispBc.data.flag5 = 1;
1225 if (mit->second.dispBc.data.flag6 ==
'0')
1226 mit->second.dispBc.data.flag6 = 0;
1227 if (mit->second.dispBc.data.flag6 ==
'N')
1228 mit->second.dispBc.data.flag6 = 0;
1229 if (mit->second.dispBc.data.flag6)
1230 mit->second.dispBc.data.flag6 = 1;
1232 mit->second.dispBc);
1234 if (mit->second.forceBc.data.value1 != 0 ||
1235 mit->second.forceBc.data.value2 != 0) {
1237 mit->second.forceBc);
1240 if (mit->second.temperatureBc.data.flag1) {
1241 if (mit->second.temperatureBc.data.flag1 ==
'0')
1242 mit->second.temperatureBc.data.flag1 = 0;
1243 if (mit->second.temperatureBc.data.flag1 ==
'N')
1244 mit->second.temperatureBc.data.flag1 = 0;
1245 if (mit->second.temperatureBc.data.flag1)
1246 mit->second.temperatureBc.data.flag1 = 1;
1248 mit->second.temperatureBc);
1252 if ((
CubitBCType(mit->second.bcType) & cubit_meshset_it->getBcType())
1254 mit->second.iD == cubit_meshset_it->getMeshsetId()) {
1263 if (mit->second.pressureBc.data.value1 != 0) {
1264 if (mit->second.pressureBc.data.flag2 ==
'0')
1265 mit->second.pressureBc.data.flag2 = 0;
1266 if (mit->second.pressureBc.data.flag2 ==
'N')
1267 mit->second.pressureBc.data.flag2 = 0;
1268 if (mit->second.pressureBc.data.flag2)
1269 mit->second.pressureBc.data.flag2 = 1;
1271 mit->second.pressureBc);
1274 if (mit->second.heatFluxBc.data.value1 != 0) {
1275 if (mit->second.heatFluxBc.data.flag1 ==
'0')
1276 mit->second.heatFluxBc.data.flag1 = 0;
1277 if (mit->second.heatFluxBc.data.flag1 ==
'N')
1278 mit->second.heatFluxBc.data.flag1 = 0;
1279 if (mit->second.heatFluxBc.data.flag1)
1280 mit->second.heatFluxBc.data.flag1 = 1;
1282 mit->second.heatFluxBc);
1285 if (mit->second.cfgBc.data.type != 0) {
1286 CHKERR setBcData(mit->second.bcType, mit->second.iD, mit->second.cfgBc);
1291 "Not yet implemented type\n");
1295 for (
auto set_attr : block_set_attributes) {
1297 if (set_attr.second.numberOfAttributes > 0) {
1298 MOFEM_LOG(
"MeshsetMngSelf", Sev::verbose)
1299 <<
"Set attributes to blockset " << set_attr.second.nAme;
1300 set_attr.second.aTtr.resize(set_attr.second.numberOfAttributes);
1302 set_attr.second.aTtr);
1312 char meshset_file_name[255] =
"config_file.cfg";
1314 CHKERR PetscOptionsBegin(m_field.
get_comm(),
"",
"Set meshsets form file",
1316 CHKERR PetscOptionsString(
"-meshsets_config",
"meshsets config file name",
1317 "",
"add_cubit_meshsets.in", meshset_file_name, 255,
1319 if (flg_file == PETSC_TRUE) {
1320 ifstream f(meshset_file_name);
1323 "File configuring meshsets ( %s ) can not be open\n",
1328 ierr = PetscOptionsEnd();
1334 const int ms_id,
const unsigned int cubit_bc_type,
1335 const std::string file_name,
const std::string file_type,
1336 const std::string options)
const {
1343 CHKERR m_field.
get_moab().write_file(file_name.c_str(), file_type.c_str(),
1344 options.c_str(), &meshset, 1);
1349 const int ms_id,
const unsigned int cubit_bc_type,
const int dim,
1350 const std::string file_name,
const bool recursive,
1351 const std::string file_type,
const std::string options)
const {
1355 moab::Interface &moab = m_field.
get_moab();
1359 CHKERR moab.create_meshset(MESHSET_SET, meshset);
1360 CHKERR moab.add_entities(meshset, entities);
1361 CHKERR moab.write_file(file_name.c_str(), file_type.c_str(), options.c_str(),
1363 CHKERR moab.delete_entities(&meshset, 1);
#define MOFEM_LOG_SEVERITY_SYNC(comm, severity)
Synchronise "SYNC" on curtain severity level.
#define MOFEM_LOG_C(channel, severity, format,...)
MoFEMTypes
Those types control how functions respond on arguments, f.e. error handling.
#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 CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
#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"
@ MAT_THERMALSET
block name is "MAT_THERMAL"
@ MAT_MOISTURESET
block name is "MAT_MOISTURE"
@ MOFEM_OPERATION_UNSUCCESSFUL
@ MOFEM_DATA_INCONSISTENCY
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 ...
FTensor::Index< 'm', SPACE_DIM > m
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 getMeshset(const int ms_id, const unsigned int cubit_bc_type, EntityHandle &meshset) const
get meshset from CUBIT Id and CUBIT type
bool checkMeshset(const int ms_id, const CubitBCType cubit_bc_type) const
check for CUBIT Id and CUBIT type
#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 addMeshset(const CubitBCType cubit_bc_type, const int ms_id, const std::string name="")
add cubit meshset
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
#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.
FTensor::Index< 'i', SPACE_DIM > i
const double c
speed of light (cm/ns)
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< 32 > CubitBCType
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
implementation of Data Operators for Forces and Sources
constexpr double t
plate stiffness
PressureCubitBcData pressureBc
Mat_Elastic_TransIso matTransIso
HeatFluxCubitBcData heatFluxBc
DisplacementCubitBcData dispBc
std::vector< double > aTtr
TemperatureCubitBcData temperatureBc
EntityHandle cubitMeshset
Definition of the cfd_bc data structure.
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
this struct keeps basic methods for moab meshset about material and boundary conditions
EntityHandle getMeshset() const
get bc meshset
MultiIndex Tag for field id.
Deprecated interface functions.
Definition of the displacement bc data structure.
Definition of the force bc data structure.
Generic attribute data structure.
Generic bc data structure.
const CubitBCType tYpe
Type of boundary condition.
Definition of the heat flux bc data structure.
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.
static bool brodcastMeshsets
MeshsetsManager(const MoFEM::Core &core)
MoFEMErrorCode printForceSet() const
print meshsets with force boundary conditions data structure
MoFEMErrorCode saveMeshsetToFile(const int ms_id, const unsigned int cubit_bc_type, const std::string file_name="out_meshset.vtk", const std::string file_type="VTK", const std::string options="") const
save cubit meshset entities on the moab mesh
MoFEMErrorCode setBcData(const CubitBCType cubit_bc_type, const int ms_id, const GenericCubitBcData &data)
set boundary data structure to meshset
MoFEMErrorCode broadcastMeshsets(int verb=DEFAULT_VERBOSITY)
Boradcats meshsets.
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=DEFAULT_VERBOSITY)
MoFEMErrorCode setAtributes(const CubitBCType cubit_bc_type, const int ms_id, const std::vector< double > &attributes, const std::string name="")
set attributes to cubit meshset
MoFEMErrorCode deleteMeshset(const CubitBCType cubit_bc_type, const int ms_id, const MoFEMTypes bh=MF_EXIST)
delete cubit meshset
MoFEMErrorCode clearMap()
clear multi-index container
MoFEMErrorCode addEntitiesToMeshset(const CubitBCType cubit_bc_type, const int ms_id, const Range &ents)
add entities to cubit meshset
bool checkIfMeshsetContainsEntities(const int ms_id, const unsigned int cubit_bc_type, const EntityHandle *entities, int num_entities, const int operation_type=moab::Interface::INTERSECT)
Check if meshset constains entities.
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
MoFEMErrorCode updateAllMeshsetsByEntitiesChildren(const BitRefLevel &bit)
Update all blolsets, sidesets and node sets.
MoFEMErrorCode printPressureSet() const
print meshsets with pressure boundary conditions data structure
MoFEMErrorCode printBcSet(CUBIT_BC_DATA_TYPE &data, unsigned long int type) const
MoFEMErrorCode printMaterialsSet() const
print meshsets with material data structure set on it
MoFEMErrorCode setMeshsetFromFile()
get name of config file from line command '-meshsets_config'
MoFEMErrorCode setAtributesByDataStructure(const CubitBCType cubit_bc_type, const int ms_id, const GenericAttributeData &data, const std::string name="")
set (material) data structure to cubit meshset
CubitMeshSet_multiIndex cubitMeshsets
cubit meshsets
MoFEMErrorCode readMeshsets(int verb=DEFAULT_VERBOSITY)
Boradcats meshsets.
MoFEMErrorCode printHeatFluxSet() const
print meshsets with heat flux boundary conditions data structure
MoFEMErrorCode printTemperatureSet() const
print meshsets with temperature boundary conditions data structure
MoFEMErrorCode getTags(int verb=-1)
get tags handlers used on meshsets
boost::shared_ptr< boost::program_options::options_description > configFileOptionsPtr
config file options
MoFEMErrorCode printDisplacementSet() const
print meshsets with displacement boundary conditions data structure
Definition of the pressure bc data structure.
Definition of the temperature bc data structure.
base class for all interface classes
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.