9 #include <stk_io/MeshReadWriteUtils.hpp>
11 #include <stk_mesh/base/BulkData.hpp>
12 #include <stk_mesh/base/GetEntities.hpp>
13 #include <stk_mesh/fem/FEMMetaData.hpp>
14 #include <stk_mesh/fem/FEMHelpers.hpp>
16 #include <stk_mesh/base/Field.hpp>
17 #include <stk_mesh/base/FieldData.hpp>
18 #include <stk_mesh/base/FieldParallel.hpp>
20 #include <Shards_BasicTopologies.hpp>
22 #include <stk_io/IossBridge.hpp>
24 #include <Ioss_SubSystem.h>
26 #include <stk_util/util/tokenize.hpp>
37 assert(sset->type() == Ioss::SIDESET);
38 const Ioss::SideBlockContainer& blocks = sset->get_side_blocks();
42 assert(ss_part != NULL);
45 bool surface_df_defined =
false;
47 size_t block_count = sset->block_count();
48 for (
size_t i=0; i < block_count; i++) {
49 Ioss::SideBlock *sb = sset->get_block(i);
52 assert(sb_part != NULL);
55 if (sb->field_exists(
"distribution_factors")) {
56 if (!surface_df_defined) {
57 std::string field_name = sset->name() +
"_df";
58 distribution_factors_field =
62 surface_df_defined =
true;
65 int side_node_count = sb->topology()->number_nodes();
67 stk::io::part_primary_entity_rank(*sb_part),
68 *sb_part, side_node_count);
76 std::vector<stk::mesh::Entity*> &entities,
80 stk::mesh::EntityRank type = stk::io::part_primary_entity_rank(part);
84 if (anded_selector) selector &= *anded_selector;
87 return entities.size();
92 template <
typename INT>
95 assert(sset->type() == Ioss::SIDESET);
99 size_t block_count = sset->block_count();
100 for (
size_t i=0; i < block_count; i++) {
101 Ioss::SideBlock *block = sset->get_block(i);
103 std::vector<INT> side_ids ;
104 std::vector<INT> elem_side ;
107 stk::mesh::EntityRank elem_rank = fem_meta.element_rank();
109 block->get_field_data(
"ids", side_ids);
110 block->get_field_data(
"element_side", elem_side);
112 assert(side_ids.size() * 2 == elem_side.size());
115 size_t side_count = side_ids.size();
116 std::vector<stk::mesh::Entity*> sides(side_count);
117 for(
size_t is=0; is<side_count; ++is) {
126 int side_ordinal = elem_side[is*2+1] - 1;
141 if (df_field != NULL) {
148 Ioss::NameList names;
149 block->field_describe(Ioss::Field::ATTRIBUTE, &names);
150 for(Ioss::NameList::const_iterator I = names.begin(); I != names.end(); ++I) {
151 if(*I ==
"attribute" && names.size() > 1)
163 if (stk::io::db_api_int_size(sset) == 4)
164 process_surface_entity(sset, bulk, (
int)0);
166 process_surface_entity(sset, bulk, (int64_t)0);
171 const Ioss::NodeBlockContainer& node_blocks = region.get_node_blocks();
172 assert(node_blocks.size() == 1);
174 Ioss::NodeBlock *nb = node_blocks[0];
176 assert(nb->field_exists(
"mesh_model_coordinates"));
177 Ioss::Field coordinates = nb->get_field(
"mesh_model_coordinates");
178 int spatial_dim = coordinates.transformed_storage()->component_count();
196 const Ioss::NodeBlockContainer& node_blocks = region.get_node_blocks();
197 assert(node_blocks.size() == 1);
199 Ioss::NodeBlock *nb = node_blocks[0];
201 std::vector<stk::mesh::Entity*> nodes;
212 Ioss::NameList names;
213 nb->field_describe(Ioss::Field::ATTRIBUTE, &names);
214 for(Ioss::NameList::const_iterator I = names.begin(); I != names.end(); ++I) {
215 if(*I ==
"attribute" && names.size() > 1)
226 const Ioss::ElementBlockContainer& elem_blocks = region.get_element_blocks();
230 template <
typename INT>
235 const Ioss::ElementBlockContainer& elem_blocks = region.get_element_blocks();
236 for(Ioss::ElementBlockContainer::const_iterator it = elem_blocks.begin();
237 it != elem_blocks.end(); ++it) {
238 Ioss::ElementBlock *entity = *it;
241 const std::string &name = entity->name();
243 assert(part != NULL);
245 const CellTopologyData* cell_topo = stk::io::get_cell_topology(*part);
246 if (cell_topo == NULL) {
247 std::ostringstream msg ;
248 msg <<
" INTERNAL_ERROR: Part " << part->
name() <<
" returned NULL from get_cell_topology()";
249 throw std::runtime_error( msg.str() );
252 std::vector<INT> elem_ids ;
253 std::vector<INT> connectivity ;
255 entity->get_field_data(
"ids", elem_ids);
256 entity->get_field_data(
"connectivity", connectivity);
258 size_t element_count = elem_ids.size();
259 int nodes_per_elem = cell_topo->node_count ;
261 std::vector<stk::mesh::EntityId> id_vec(nodes_per_elem);
262 std::vector<stk::mesh::Entity*> elements(element_count);
264 for(
size_t i=0; i<element_count; ++i) {
265 INT *conn = &connectivity[i*nodes_per_elem];
266 std::copy(&conn[0], &conn[0+nodes_per_elem], id_vec.begin());
273 Ioss::NameList names;
274 entity->field_describe(Ioss::Field::ATTRIBUTE, &names);
275 for(Ioss::NameList::const_iterator I = names.begin(); I != names.end(); ++I) {
276 if(*I ==
"attribute" && names.size() > 1)
290 const Ioss::NodeSetContainer& node_sets = region.get_nodesets();
302 for(Ioss::NodeSetContainer::const_iterator it = node_sets.begin();
303 it != node_sets.end(); ++it) {
304 Ioss::NodeSet *entity = *it;
308 assert(part != NULL);
309 assert(entity->field_exists(
"distribution_factors"));
320 const Ioss::SideSetContainer& side_sets = region.get_sidesets();
323 for(Ioss::SideSetContainer::const_iterator it = side_sets.begin();
324 it != side_sets.end(); ++it) {
325 Ioss::SideSet *entity = *it;
328 process_surface_entity(entity, fem_meta);
334 template <
typename INT>
339 const Ioss::NodeSetContainer& node_sets = region.get_nodesets();
342 for(Ioss::NodeSetContainer::const_iterator it = node_sets.begin();
343 it != node_sets.end(); ++it) {
344 Ioss::NodeSet *entity = *it;
347 const std::string & name = entity->name();
349 assert(part != NULL);
352 std::vector<INT> node_ids ;
353 size_t node_count = entity->get_field_data(
"ids", node_ids);
355 std::vector<stk::mesh::Entity*> nodes(node_count);
356 stk::mesh::EntityRank n_rank = fem_meta.
node_rank();
357 for(
size_t i=0; i<node_count; ++i) {
358 nodes[i] = bulk.
get_entity(n_rank, node_ids[i] );
359 if (nodes[i] != NULL)
366 if (df_field != NULL) {
373 Ioss::NameList names;
374 entity->field_describe(Ioss::Field::ATTRIBUTE, &names);
375 for(Ioss::NameList::const_iterator I = names.begin(); I != names.end(); ++I) {
376 if(*I ==
"attribute" && names.size() > 1)
389 const Ioss::SideSetContainer& side_sets = region.get_sidesets();
391 for(Ioss::SideSetContainer::const_iterator it = side_sets.begin();
392 it != side_sets.end(); ++it) {
393 Ioss::SideSet *entity = *it;
396 process_surface_entity(entity, bulk);
403 stk::mesh::EntityRank part_type,
404 Ioss::GroupingEntity *io_entity,
405 Ioss::Field::RoleType filter_role,
408 std::vector<stk::mesh::Entity*> entities;
409 if (io_entity->type() == Ioss::SIDEBLOCK) {
414 size_t num_sides =
get_entities(part, bulk, entities, anded_selector);
415 if (num_sides != (
size_t)io_entity->get_property(
"entity_count").get_int()) {
416 std::ostringstream msg ;
417 msg <<
" INTERNAL_ERROR: Number of sides on part " << part.
name() <<
" (" << num_sides
418 <<
") does not match number of sides in the associated Ioss SideBlock named "
419 << io_entity->name() <<
" (" << io_entity->get_property(
"entity_count").get_int()
421 throw std::runtime_error( msg.str() );
428 const std::vector<stk::mesh::FieldBase*> &fields = fem_meta.
get_fields();
430 std::vector<stk::mesh::FieldBase *>::const_iterator I = fields.begin();
431 while (I != fields.end()) {
437 void internal_process_output_request(stk::io::MeshData &mesh_data,
440 const std::set<const stk::mesh::Part*> &exclude)
442 Ioss::Region *region = mesh_data.m_output_region;
443 region->begin_state(step);
448 region->get_node_blocks()[0], Ioss::Field::Field::TRANSIENT,
449 mesh_data.m_anded_selector);
453 for ( stk::mesh::PartVector::const_iterator
454 ip = all_parts.begin(); ip != all_parts.end(); ++ip ) {
461 Ioss::GroupingEntity *entity = region->get_entity(part->
name());
462 if (entity != NULL && entity->type() != Ioss::SIDESET) {
463 put_field_data(bulk, *part, stk::io::part_primary_entity_rank(*part),
464 entity, Ioss::Field::Field::TRANSIENT,
465 mesh_data.m_anded_selector);
469 region->end_state(step);
475 MeshData::~MeshData()
477 delete m_input_region;
478 delete m_output_region;
483 std::cerr <<
"Options are:\n"
485 <<
"filename -- specify the name of the file from which to read the\n"
486 <<
" mesh file. If the --directory option is specified, it will be\n"
487 <<
" prepended to the filename unless the filename specifies an absolute path.\n"
489 <<
"gen:NxMxL -- internally generate a hex mesh of size N by M by L\n"
490 <<
" intervals. See 'Generated Options' below for more options.\n"
492 <<
"Generated Options:\n"
494 <<
"The argument specifies whether there is a shell block\n"
495 <<
"at the location. 'x' is minX, 'X' is maxX, etc.\n"
497 <<
"help -- no argument, shows valid options\n"
499 <<
"show -- no argument, prints out a summary of the settings used to\n"
500 <<
"generate the mesh. The output will look similar to:\n"
501 <<
" \"10x12x8|shell:xX|bbox:-10,-10,-10,10,10,10|show\"\n"
503 <<
" Mesh Parameters:\n"
504 <<
"\tIntervals: 10 by 12 by 8\n"
505 <<
"\tX = 2 * (0..10) + -10 Range: -10 <= X <= 10\n"
506 <<
"\tY = 1.66667 * (0..12) + -10 Range: -10 <= Y <= 10\n"
507 <<
"\tZ = 2.5 * (0..8) + -10 Range: -10 <= Z <= 10\n"
508 <<
"\tNode Count (total) = 1287\n"
509 <<
"\tElement Count (total) = 1152\n"
510 <<
"\tBlock Count = 3\n"
513 <<
"which specifies whether there is a shell block at that\n"
514 <<
"location. 'x' is minimum x face, 'X' is maximum x face,\n"
515 <<
"similarly for y and z. Note that the argument string is a\n"
516 <<
"single multicharacter string. You can add multiple shell blocks\n"
517 <<
"to a face, for example, shell:xxx would add three layered shell\n"
518 <<
"blocks on the minimum x face. An error is output if a non\n"
519 <<
"xXyYzZ character is found, but execution continues.\n"
521 <<
"zdecomp:n0 n1,n2,...,n#proc-1\n"
522 <<
"which are the number of intervals in the z direction for each\n"
523 <<
"processor in a pallel run. If this option is specified, then\n"
524 <<
"the total number of intervals in the z direction is the sum of\n"
525 <<
"the n0, n1, ... An interval count must be specified for each\n"
526 <<
"processor. If this option is not specified, then the number of\n"
527 <<
"intervals on each processor in the z direction is numZ/numProc\n"
528 <<
"with the extras added to the lower numbered processors.\n"
530 <<
"scale:xs,ys,zs\n"
531 <<
"which are the scale factors in the x, y, and z directions. All\n"
532 <<
"three must be specified if this option is present.\n"
534 <<
"- offset -- argument = xoff, yoff, zoff which are the offsets in the\n"
535 <<
"x, y, and z directions. All three must be specified if this option\n"
538 <<
"- bbox -- argument = xmin, ymin, zmin, xmax, ymax, zmax\n"
539 <<
"which specify the lower left and upper right corners of\n"
540 <<
"the bounding box for the generated mesh. This will\n"
541 <<
"calculate the scale and offset which will fit the mesh in\n"
542 <<
"the specified box. All calculations are based on the currently\n"
543 <<
"active interval settings. If scale or offset or zdecomp\n"
544 <<
"specified later in the option list, you may not get the\n"
545 <<
"desired bounding box.\n"
547 <<
"- rotate -- argument = axis,angle,axis,angle,...\n"
548 <<
"where axis is 'x', 'y', or 'z' and angle is the rotation angle in\n"
549 <<
"degrees. Multiple rotations are cumulative. The composite rotation\n"
550 <<
"matrix is applied at the time the coordinates are retrieved after\n"
551 <<
"scaling and offset are applied.\n"
553 <<
"The unrotated coordinate of a node at grid location i,j,k is:\n"
555 <<
"\tx = x_scale * i + x_off,\n"
556 <<
"\ty = z_scale * j + y_off,\n"
557 <<
"\tz = z_scale * k + z_off,\n"
559 <<
"The extent of the unrotated mesh will be:\n"
561 <<
"\tx_off <= x <= x_scale * numX + x_off\n"
562 <<
"\ty_off <= y <= y_scale * numY + y_off\n"
563 <<
"\tz_off <= z <= z_scale * numZ + z_off\n"
565 <<
"If an unrecognized option is specified, an error message will be\n"
566 <<
"output and execution will continue.\n"
568 <<
"An example of valid input is:\n"
570 <<
"\t\"10x20x40|scale:1,0.5,0.25|offset:-5,-5,-5|shell:xX\"\n"
573 <<
"This would create a mesh with 10 intervals in x, 20 in y, 40 in z\n"
574 <<
"The mesh would be centered on 0,0,0 with a range of 10 in each\n"
575 <<
"direction. There would be a shell layer on the min and max\n"
578 <<
"NOTE: All options are processed in the order they appear in\n"
579 <<
"the parameters string (except rotate which is applied at the\n"
580 <<
"time the coordinates are generated/retrieved)\n"
585 const std::string &mesh_filename,
588 stk::io::MeshData &mesh_data)
590 Ioss::Region *in_region = mesh_data.m_input_region;
591 if (in_region == NULL) {
595 Ioss::DatabaseIO *dbi = Ioss::IOFactory::create(mesh_type, mesh_filename,
596 Ioss::READ_MODEL, comm,
597 mesh_data.m_property_manager);
598 if (dbi == NULL || !dbi->ok()) {
599 std::cerr <<
"ERROR: Could not open database '" << mesh_filename
600 <<
"' of type '" << mesh_type <<
"'\n";
601 Ioss::NameList db_types;
602 Ioss::IOFactory::describe(&db_types);
603 std::cerr <<
"\nSupported database types:\n\t";
604 for (Ioss::NameList::const_iterator IF = db_types.begin(); IF != db_types.end(); ++IF) {
605 std::cerr << *IF <<
" ";
611 in_region =
new Ioss::Region(dbi,
"input_model");
612 mesh_data.m_input_region = in_region;
615 size_t spatial_dimension = in_region->get_property(
"spatial_dimension").get_int();
616 initialize_spatial_dimension(fem_meta, spatial_dimension, stk::mesh::fem::entity_rank_names(spatial_dimension));
618 process_elementblocks(*in_region, fem_meta);
619 process_nodeblocks(*in_region, fem_meta);
620 process_sidesets(*in_region, fem_meta);
621 process_nodesets(*in_region, fem_meta);
625 const std::string &mesh_filename,
628 stk::io::MeshData &mesh_data,
629 const std::vector<std::string>& names_to_add)
631 Ioss::Region *in_region = mesh_data.m_input_region;
632 if (in_region == NULL) {
636 Ioss::DatabaseIO *dbi = Ioss::IOFactory::create(mesh_type, mesh_filename,
637 Ioss::READ_MODEL, comm,
638 mesh_data.m_property_manager);
639 if (dbi == NULL || !dbi->ok()) {
640 std::cerr <<
"ERROR: Could not open database '" << mesh_filename
641 <<
"' of type '" << mesh_type <<
"'\n";
642 Ioss::NameList db_types;
643 Ioss::IOFactory::describe(&db_types);
644 std::cerr <<
"\nSupported database types:\n\t";
645 for (Ioss::NameList::const_iterator IF = db_types.begin(); IF != db_types.end(); ++IF) {
646 std::cerr << *IF <<
" ";
652 in_region =
new Ioss::Region(dbi,
"input_model");
653 mesh_data.m_input_region = in_region;
656 size_t spatial_dimension = in_region->get_property(
"spatial_dimension").get_int();
658 std::vector<std::string> entity_rank_names = stk::mesh::fem::entity_rank_names(spatial_dimension);
660 for(std::size_t i = 0; i < names_to_add.size(); i++)
661 entity_rank_names.push_back(names_to_add[i]);
663 initialize_spatial_dimension(fem_meta, spatial_dimension, entity_rank_names);
665 process_elementblocks(*in_region, fem_meta);
666 process_nodeblocks(*in_region, fem_meta);
667 process_sidesets(*in_region, fem_meta);
668 process_nodesets(*in_region, fem_meta);
677 Ioss::Region *out_region = NULL;
679 std::string out_filename = filename;
680 if (filename.empty()) {
681 out_filename =
"default_output_mesh";
686 std::vector<std::string> tokens;
687 stk::util::tokenize(out_filename,
"+|:,", tokens);
688 out_filename = tokens[0];
691 Ioss::DatabaseIO *dbo = Ioss::IOFactory::create(
"exodusII", out_filename,
693 comm, mesh_data.m_property_manager);
694 if (dbo == NULL || !dbo->ok()) {
695 std::cerr <<
"ERROR: Could not open results database '" << out_filename
696 <<
"' of type 'exodusII'\n";
697 std::exit(EXIT_FAILURE);
701 out_region =
new Ioss::Region(dbo,
"results_output");
705 mesh_data.m_output_region = out_region;
712 const std::set<const stk::mesh::Part*> &exclude)
714 Ioss::Region *region = mesh_data.m_output_region;
715 region->begin_mode(Ioss::STATE_TRANSIENT);
717 int out_step = region->add_state(time);
718 internal_process_output_request(mesh_data, bulk, out_step,exclude);
720 region->end_mode(Ioss::STATE_TRANSIENT);
729 Ioss::Region *region = mesh_data.m_input_region;
738 std::cerr <<
"INTERNAL ERROR: Mesh Input Region pointer is NULL in populate_bulk_data.\n";
739 std::exit(EXIT_FAILURE);
746 bool ints64bit = db_api_int_size(region) == 8;
749 process_elementblocks(*region, bulk_data, zero);
750 process_nodeblocks(*region, bulk_data);
751 process_nodesets(*region, bulk_data, zero);
752 process_sidesets(*region, bulk_data);
755 process_elementblocks(*region, bulk_data, zero);
756 process_nodeblocks(*region, bulk_data);
757 process_nodesets(*region, bulk_data, zero);
758 process_sidesets(*region, bulk_data);
768 void internal_process_input_request(Ioss::GroupingEntity *io_entity,
772 assert(io_entity != NULL);
773 std::vector<stk::mesh::Entity*> entity_list;
774 stk::io::get_entity_list(io_entity, entity_rank, bulk, entity_list);
778 Ioss::NameList names;
779 io_entity->field_describe(Ioss::Field::TRANSIENT, &names);
780 for (Ioss::NameList::const_iterator I = names.begin(); I != names.end(); ++I) {
791 const Ioss::NodeBlockContainer& node_blocks = region.get_node_blocks();
792 assert(node_blocks.size() == 1);
794 Ioss::NodeBlock *nb = node_blocks[0];
795 internal_process_input_request(nb, fem_meta.
node_rank(), bulk);
801 const Ioss::ElementBlockContainer& elem_blocks = region.get_element_blocks();
802 for(
size_t i=0; i < elem_blocks.size(); i++) {
804 internal_process_input_request(elem_blocks[i], fem_meta.
element_rank(), bulk);
812 const Ioss::NodeSetContainer& nodesets = region.get_nodesets();
813 for(
size_t i=0; i < nodesets.size(); i++) {
815 internal_process_input_request(nodesets[i], fem_meta.
node_rank(), bulk);
826 const Ioss::SideSetContainer& side_sets = region.get_sidesets();
827 for(Ioss::SideSetContainer::const_iterator it = side_sets.begin();
828 it != side_sets.end(); ++it) {
829 Ioss::SideSet *entity = *it;
831 const Ioss::SideBlockContainer& blocks = entity->get_side_blocks();
832 for(
size_t i=0; i < blocks.size(); i++) {
834 internal_process_input_request(blocks[i], fem_meta.
side_rank(), bulk);
843 const Ioss::NodeBlockContainer& node_blocks = region.get_node_blocks();
844 assert(node_blocks.size() == 1);
846 Ioss::NodeBlock *nb = node_blocks[0];
853 const Ioss::ElementBlockContainer& elem_blocks = region.get_element_blocks();
854 for(
size_t i=0; i < elem_blocks.size(); i++) {
857 assert(part != NULL);
859 *part, part_primary_entity_rank(*part));
866 const Ioss::NodeSetContainer& nodesets = region.get_nodesets();
867 for(
size_t i=0; i < nodesets.size(); i++) {
870 assert(part != NULL);
872 *part, part_primary_entity_rank(*part));
882 const Ioss::SideSetContainer& side_sets = region.get_sidesets();
883 for(Ioss::SideSetContainer::const_iterator it = side_sets.begin();
884 it != side_sets.end(); ++it) {
885 Ioss::SideSet *entity = *it;
887 const Ioss::SideBlockContainer& blocks = entity->get_side_blocks();
888 for(
size_t i=0; i < blocks.size(); i++) {
891 assert(part != NULL);
893 *part, part_primary_entity_rank(*part));
916 Ioss::Region *region = mesh_data.m_input_region;
918 define_input_nodeblock_fields(*region, fem_meta);
919 define_input_elementblock_fields(*region, fem_meta);
920 define_input_nodeset_fields(*region, fem_meta);
921 define_input_sideset_fields(*region, fem_meta);
923 std::cerr <<
"INTERNAL ERROR: Mesh Input Region pointer is NULL in process_input_request.\n";
924 std::exit(EXIT_FAILURE);
940 Ioss::Region *region = mesh_data.m_output_region;
942 region->begin_mode(Ioss::STATE_DEFINE_TRANSIENT);
946 region->get_node_blocks()[0],
947 Ioss::Field::TRANSIENT, add_all_fields);
950 for ( stk::mesh::PartVector::const_iterator
951 ip = all_parts.begin(); ip != all_parts.end(); ++ip ) {
958 Ioss::GroupingEntity *entity = region->get_entity(part->
name());
959 if (entity != NULL) {
961 entity, Ioss::Field::TRANSIENT, add_all_fields);
965 region->end_mode(Ioss::STATE_DEFINE_TRANSIENT);
967 std::cerr <<
"INTERNAL ERROR: Mesh Input Region pointer is NULL in process_input_request.\n";
968 std::exit(EXIT_FAILURE);
975 Ioss::Region *region = mesh_data.m_input_region;
976 int step_count = region->get_property(
"state_count").get_int();
977 double delta_min = 1.0e30;
979 for (
int istep = 0; istep < step_count; istep++) {
980 double state_time = region->get_state_time(istep+1);
981 double delta = state_time - time;
982 if (delta < 0.0) delta = -delta;
983 if (delta < delta_min) {
986 if (delta == 0.0)
break;
1000 Ioss::Region *region = mesh_data.m_input_region;
1009 std::cerr <<
"INTERNAL ERROR: Mesh Input Region pointer is NULL in process_input_request.\n";
1010 std::exit(EXIT_FAILURE);
1018 int step_count = region->get_property(
"state_count").get_int();
1019 double delta_min = 1.0e30;
1021 for (
int istep = 0; istep < step_count; istep++) {
1022 double state_time = region->get_state_time(istep+1);
1023 double delta = state_time - time;
1024 if (delta < 0.0) delta = -delta;
1025 if (delta < delta_min) {
1028 if (delta == 0.0)
break;
1039 region->begin_state(step);
1041 input_nodeblock_fields(*region, bulk);
1042 input_elementblock_fields(*region, bulk);
1043 input_nodeset_fields(*region, bulk);
1044 input_sideset_fields(*region, bulk);
1046 region->end_state(step);
1050 template <
typename INT>
1052 std::vector<INT>& el_blocks)
1054 Ioss::Region *io = mesh_data.m_input_region;
1055 const Ioss::ElementBlockContainer& elem_blocks = io->get_element_blocks();
1056 for(Ioss::ElementBlockContainer::const_iterator it = elem_blocks.begin(); it != elem_blocks.end(); ++it) {
1057 Ioss::ElementBlock *entity = *it;
1059 el_blocks.push_back(entity->get_property(
"entity_count").get_int());
bool is_part_io_part(stk::mesh::Part &part)
void change_entity_parts(Entity &entity, const PartVector &add_parts, const PartVector &remove_parts=PartVector())
Change the parallel-locally-owned entity's part membership by adding and/or removing parts...
void field_data_to_ioss(const stk::mesh::FieldBase *field, std::vector< stk::mesh::Entity * > &entities, Ioss::GroupingEntity *io_entity, const std::string &io_fld_name, Ioss::Field::RoleType filter_role)
std::vector< Part * > PartVector
Collections of parts are frequently maintained as a vector of Part pointers.
This is a class for selecting buckets based on a set of meshparts and set logic.
void process_mesh_bulk_data(Ioss::Region *region, stk::mesh::BulkData &bulk_data)
void get_selected_entities(const Selector &selector, const std::vector< Bucket * > &input_buckets, std::vector< Entity * > &entities)
Get entities in selected buckets (selected by the given selector instance), and sorted by ID...
const std::string & name() const
Application-defined text name of this field.
Field with defined data type and multi-dimensions (if any)
void create_output_mesh(const std::string &filename, stk::ParallelMachine comm, stk::mesh::BulkData &bulk_data, MeshData &mesh_data)
void get_entity_list(Ioss::GroupingEntity *io_entity, stk::mesh::EntityRank part_type, const stk::mesh::BulkData &bulk, std::vector< stk::mesh::Entity * > &entities)
EntityRank entity_rank(const EntityKey &key)
Given an entity key, return an entity type (rank).
bool include_entity(const Ioss::GroupingEntity *entity)
void set_distribution_factor_field(stk::mesh::Part &p, const stk::mesh::Field< double, stk::mesh::ElementNode > &df_field)
int process_output_request(MeshData &mesh_data, stk::mesh::BulkData &bulk, double time, const std::set< const stk::mesh::Part * > &exclude)
Entity * get_entity(EntityRank entity_rank, EntityId entity_id) const
Get entity with a given key.
A fundamental unit within the discretization of a problem domain, including but not limited to nodes...
void set_field_role(stk::mesh::FieldBase &f, const Ioss::Field::RoleType &role)
void populate_bulk_data(stk::mesh::BulkData &bulk_data, MeshData &mesh_data)
void process_input_request(MeshData &mesh_data, stk::mesh::BulkData &bulk, double time)
void input_mesh_fields(Ioss::Region *region, stk::mesh::BulkData &bulk, double time)
bool modification_end()
Parallel synchronization of modifications and transition to the guaranteed parallel consistent state...
const std::string & name() const
Application-defined text name of this part.
void create_input_mesh(const std::string &mesh_type, const std::string &mesh_filename, stk::ParallelMachine comm, stk::mesh::fem::FEMMetaData &fem_meta, stk::io::MeshData &mesh_data)
const stk::mesh::Field< double, stk::mesh::ElementNode > * get_distribution_factor_field(const stk::mesh::Part &p)
void get_element_block_sizes(MeshData &mesh_data, std::vector< INT > &el_blocks)
void define_output_db(Ioss::Region &io_region, const mesh::BulkData &bulk_data, const Ioss::Region *input_region, const stk::mesh::Selector *anded_selector, const bool sort_stk_parts)
Field base class with an anonymous data type and anonymous multi-dimension.
void get_entities(const BulkData &mesh, EntityRank entity_rank, std::vector< Entity * > &entities)
Get all entities of the specified type, sorted by ID.
void define_output_fields(const MeshData &mesh_data, const stk::mesh::fem::FEMMetaData &fem_meta, bool add_all_fields)
field_type & put_field(field_type &field, EntityRank entity_rank, const Part &part, const void *init_value=NULL)
Declare a field to exist for a given entity type and Part.
An application-defined subset of a problem domain.
Manager for an integrated collection of entities, entity relations, and buckets of field data...
const std::vector< Bucket * > & buckets(EntityRank rank) const
Query all buckets of a given entity rank.
Entity & declare_element_side(Entity &elem, Entity &side, const unsigned local_side_id, Part *part)
Create (or find) an element side.
void define_input_fields(MeshData &mesh_data, stk::mesh::fem::FEMMetaData &fem_meta)
void write_output_db(Ioss::Region &io_region, const stk::mesh::BulkData &bulk, const stk::mesh::Selector *anded_selector)
Entity & declare_element(BulkData &mesh, Part &part, const EntityId elem_id, const EntityId node_id[])
Declare an element member of a Part with a CellTopology and nodes conformal to that topology...
Entity & declare_entity(EntityRank ent_rank, EntityId ent_id, const PartVector &parts)
Create or retrieve a locally owned entity of a given rank and id.
void ioss_add_fields(const stk::mesh::Part &part, const stk::mesh::EntityRank part_type, Ioss::GroupingEntity *entity, const Ioss::Field::RoleType filter_role, const bool add_all)
void field_data_from_ioss(const stk::mesh::FieldBase *field, std::vector< stk::mesh::Entity * > &entities, Ioss::GroupingEntity *io_entity, const std::string &io_fld_name)
void default_part_processing(const std::vector< T * > &entities, stk::mesh::fem::FEMMetaData &fem_meta)
void define_io_fields(Ioss::GroupingEntity *entity, Ioss::Field::RoleType role, stk::mesh::Part &part, stk::mesh::EntityRank part_type)
bool modification_begin()
Begin a modification phase during which the mesh bulk data could become parallel inconsistent. This is a parallel synchronous call. The first time this method is called the mesh meta data is verified to be committed and parallel consistent. An exception is thrown if this verification fails.