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_classic::io::part_primary_entity_rank(*sb_part),
68 *sb_part, side_node_count);
76 std::vector<stk_classic::mesh::Entity*> &entities,
80 stk_classic::mesh::EntityRank type = stk_classic::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_classic::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_classic::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_classic::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_classic::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_classic::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_classic::mesh::EntityId> id_vec(nodes_per_elem);
262 std::vector<stk_classic::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_classic::mesh::Entity*> nodes(node_count);
356 stk_classic::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_classic::mesh::EntityRank part_type,
404 Ioss::GroupingEntity *io_entity,
405 Ioss::Field::RoleType filter_role,
408 std::vector<stk_classic::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_classic::mesh::FieldBase*> &fields = fem_meta.
get_fields();
430 std::vector<stk_classic::mesh::FieldBase *>::const_iterator I = fields.begin();
431 while (I != fields.end()) {
437 void internal_process_output_request(stk_classic::io::MeshData &mesh_data,
440 const std::set<const stk_classic::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_classic::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_classic::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_classic::io::MeshData &mesh_data,
589 bool lower_case_variable_names)
591 Ioss::Region *in_region = mesh_data.m_input_region;
592 if (in_region == NULL) {
596 Ioss::DatabaseIO *dbi = Ioss::IOFactory::create(mesh_type, mesh_filename,
597 Ioss::READ_MODEL, comm,
598 mesh_data.m_property_manager);
601 dbi->set_lower_case_variable_names(lower_case_variable_names);
603 if (dbi == NULL || !dbi->ok()) {
604 std::cerr <<
"ERROR: Could not open database '" << mesh_filename
605 <<
"' of type '" << mesh_type <<
"'\n";
606 Ioss::NameList db_types;
607 Ioss::IOFactory::describe(&db_types);
608 std::cerr <<
"\nSupported database types:\n\t";
609 for (Ioss::NameList::const_iterator IF = db_types.begin(); IF != db_types.end(); ++IF) {
610 std::cerr << *IF <<
" ";
616 in_region =
new Ioss::Region(dbi,
"input_model");
617 mesh_data.m_input_region = in_region;
620 size_t spatial_dimension = in_region->get_property(
"spatial_dimension").get_int();
621 initialize_spatial_dimension(fem_meta, spatial_dimension, stk_classic::mesh::fem::entity_rank_names(spatial_dimension));
623 process_elementblocks(*in_region, fem_meta);
624 process_nodeblocks(*in_region, fem_meta);
625 process_sidesets(*in_region, fem_meta);
626 process_nodesets(*in_region, fem_meta);
630 const std::string &mesh_filename,
633 stk_classic::io::MeshData &mesh_data,
634 const std::vector<std::string>& names_to_add,
635 bool lower_case_variable_names)
637 Ioss::Region *in_region = mesh_data.m_input_region;
638 if (in_region == NULL) {
642 Ioss::DatabaseIO *dbi = Ioss::IOFactory::create(mesh_type, mesh_filename,
643 Ioss::READ_MODEL, comm,
644 mesh_data.m_property_manager);
647 dbi->set_lower_case_variable_names(lower_case_variable_names);
649 if (dbi == NULL || !dbi->ok()) {
650 std::cerr <<
"ERROR: Could not open database '" << mesh_filename
651 <<
"' of type '" << mesh_type <<
"'\n";
652 Ioss::NameList db_types;
653 Ioss::IOFactory::describe(&db_types);
654 std::cerr <<
"\nSupported database types:\n\t";
655 for (Ioss::NameList::const_iterator IF = db_types.begin(); IF != db_types.end(); ++IF) {
656 std::cerr << *IF <<
" ";
662 in_region =
new Ioss::Region(dbi,
"input_model");
663 mesh_data.m_input_region = in_region;
666 size_t spatial_dimension = in_region->get_property(
"spatial_dimension").get_int();
668 std::vector<std::string> entity_rank_names = stk_classic::mesh::fem::entity_rank_names(spatial_dimension);
670 for(std::size_t i = 0; i < names_to_add.size(); i++)
671 entity_rank_names.push_back(names_to_add[i]);
673 initialize_spatial_dimension(fem_meta, spatial_dimension, entity_rank_names);
675 process_elementblocks(*in_region, fem_meta);
676 process_nodeblocks(*in_region, fem_meta);
677 process_sidesets(*in_region, fem_meta);
678 process_nodesets(*in_region, fem_meta);
686 bool lower_case_variable_names)
688 Ioss::Region *out_region = NULL;
690 std::string out_filename = filename;
691 if (filename.empty()) {
692 out_filename =
"default_output_mesh";
697 std::vector<std::string> tokens;
698 stk_classic::util::tokenize(out_filename,
"+|:,", tokens);
699 out_filename = tokens[0];
702 Ioss::DatabaseIO *dbo = Ioss::IOFactory::create(
"exodusII", out_filename,
704 comm, mesh_data.m_property_manager);
706 dbo->set_lower_case_variable_names(lower_case_variable_names);
708 if (dbo == NULL || !dbo->ok()) {
709 std::cerr <<
"ERROR: Could not open results database '" << out_filename
710 <<
"' of type 'exodusII'\n";
711 std::exit(EXIT_FAILURE);
715 out_region =
new Ioss::Region(dbo,
"results_output");
719 mesh_data.m_output_region = out_region;
726 const std::set<const stk_classic::mesh::Part*> &exclude)
728 Ioss::Region *region = mesh_data.m_output_region;
729 region->begin_mode(Ioss::STATE_TRANSIENT);
731 int out_step = region->add_state(time);
732 internal_process_output_request(mesh_data, bulk, out_step,exclude);
734 region->end_mode(Ioss::STATE_TRANSIENT);
743 Ioss::Region *region = mesh_data.m_input_region;
752 std::cerr <<
"INTERNAL ERROR: Mesh Input Region pointer is NULL in populate_bulk_data.\n";
753 std::exit(EXIT_FAILURE);
760 bool ints64bit = db_api_int_size(region) == 8;
763 process_elementblocks(*region, bulk_data, zero);
764 process_nodeblocks(*region, bulk_data);
765 process_nodesets(*region, bulk_data, zero);
766 process_sidesets(*region, bulk_data);
769 process_elementblocks(*region, bulk_data, zero);
770 process_nodeblocks(*region, bulk_data);
771 process_nodesets(*region, bulk_data, zero);
772 process_sidesets(*region, bulk_data);
782 void internal_process_input_request(Ioss::GroupingEntity *io_entity,
786 assert(io_entity != NULL);
787 std::vector<stk_classic::mesh::Entity*> entity_list;
788 stk_classic::io::get_entity_list(io_entity,
entity_rank, bulk, entity_list);
792 Ioss::NameList names;
793 io_entity->field_describe(Ioss::Field::TRANSIENT, &names);
794 for (Ioss::NameList::const_iterator I = names.begin(); I != names.end(); ++I) {
805 const Ioss::NodeBlockContainer& node_blocks = region.get_node_blocks();
806 assert(node_blocks.size() == 1);
808 Ioss::NodeBlock *nb = node_blocks[0];
809 internal_process_input_request(nb, fem_meta.
node_rank(), bulk);
815 const Ioss::ElementBlockContainer& elem_blocks = region.get_element_blocks();
816 for(
size_t i=0; i < elem_blocks.size(); i++) {
818 internal_process_input_request(elem_blocks[i], fem_meta.
element_rank(), bulk);
826 const Ioss::NodeSetContainer& nodesets = region.get_nodesets();
827 for(
size_t i=0; i < nodesets.size(); i++) {
829 internal_process_input_request(nodesets[i], fem_meta.
node_rank(), bulk);
840 const Ioss::SideSetContainer& side_sets = region.get_sidesets();
841 for(Ioss::SideSetContainer::const_iterator it = side_sets.begin();
842 it != side_sets.end(); ++it) {
843 Ioss::SideSet *entity = *it;
845 const Ioss::SideBlockContainer& blocks = entity->get_side_blocks();
846 for(
size_t i=0; i < blocks.size(); i++) {
848 internal_process_input_request(blocks[i], fem_meta.
side_rank(), bulk);
857 const Ioss::NodeBlockContainer& node_blocks = region.get_node_blocks();
858 assert(node_blocks.size() == 1);
860 Ioss::NodeBlock *nb = node_blocks[0];
867 const Ioss::ElementBlockContainer& elem_blocks = region.get_element_blocks();
868 for(
size_t i=0; i < elem_blocks.size(); i++) {
871 assert(part != NULL);
873 *part, part_primary_entity_rank(*part));
880 const Ioss::NodeSetContainer& nodesets = region.get_nodesets();
881 for(
size_t i=0; i < nodesets.size(); i++) {
884 assert(part != NULL);
886 *part, part_primary_entity_rank(*part));
896 const Ioss::SideSetContainer& side_sets = region.get_sidesets();
897 for(Ioss::SideSetContainer::const_iterator it = side_sets.begin();
898 it != side_sets.end(); ++it) {
899 Ioss::SideSet *entity = *it;
901 const Ioss::SideBlockContainer& blocks = entity->get_side_blocks();
902 for(
size_t i=0; i < blocks.size(); i++) {
905 assert(part != NULL);
907 *part, part_primary_entity_rank(*part));
930 Ioss::Region *region = mesh_data.m_input_region;
932 define_input_nodeblock_fields(*region, fem_meta);
933 define_input_elementblock_fields(*region, fem_meta);
934 define_input_nodeset_fields(*region, fem_meta);
935 define_input_sideset_fields(*region, fem_meta);
937 std::cerr <<
"INTERNAL ERROR: Mesh Input Region pointer is NULL in process_input_request.\n";
938 std::exit(EXIT_FAILURE);
954 Ioss::Region *region = mesh_data.m_output_region;
956 region->begin_mode(Ioss::STATE_DEFINE_TRANSIENT);
960 region->get_node_blocks()[0],
961 Ioss::Field::TRANSIENT, add_all_fields);
964 for ( stk_classic::mesh::PartVector::const_iterator
965 ip = all_parts.begin(); ip != all_parts.end(); ++ip ) {
972 Ioss::GroupingEntity *entity = region->get_entity(part->
name());
973 if (entity != NULL) {
975 entity, Ioss::Field::TRANSIENT, add_all_fields);
979 region->end_mode(Ioss::STATE_DEFINE_TRANSIENT);
981 std::cerr <<
"INTERNAL ERROR: Mesh Input Region pointer is NULL in process_input_request.\n";
982 std::exit(EXIT_FAILURE);
989 Ioss::Region *region = mesh_data.m_input_region;
990 int step_count = region->get_property(
"state_count").get_int();
991 double delta_min = 1.0e30;
993 for (
int istep = 0; istep < step_count; istep++) {
994 double state_time = region->get_state_time(istep+1);
995 double delta = state_time - time;
996 if (delta < 0.0) delta = -delta;
997 if (delta < delta_min) {
1000 if (delta == 0.0)
break;
1014 Ioss::Region *region = mesh_data.m_input_region;
1023 std::cerr <<
"INTERNAL ERROR: Mesh Input Region pointer is NULL in process_input_request.\n";
1024 std::exit(EXIT_FAILURE);
1032 int step_count = region->get_property(
"state_count").get_int();
1033 double delta_min = 1.0e30;
1035 for (
int istep = 0; istep < step_count; istep++) {
1036 double state_time = region->get_state_time(istep+1);
1037 double delta = state_time - time;
1038 if (delta < 0.0) delta = -delta;
1039 if (delta < delta_min) {
1042 if (delta == 0.0)
break;
1053 region->begin_state(step);
1055 input_nodeblock_fields(*region, bulk);
1056 input_elementblock_fields(*region, bulk);
1057 input_nodeset_fields(*region, bulk);
1058 input_sideset_fields(*region, bulk);
1060 region->end_state(step);
1064 template <
typename INT>
1066 std::vector<INT>& el_blocks)
1068 Ioss::Region *io = mesh_data.m_input_region;
1069 const Ioss::ElementBlockContainer& elem_blocks = io->get_element_blocks();
1070 for(Ioss::ElementBlockContainer::const_iterator it = elem_blocks.begin(); it != elem_blocks.end(); ++it) {
1071 Ioss::ElementBlock *entity = *it;
1073 el_blocks.push_back(entity->get_property(
"entity_count").get_int());
void get_entity_list(Ioss::GroupingEntity *io_entity, stk_classic::mesh::EntityRank part_type, const stk_classic::mesh::BulkData &bulk, std::vector< stk_classic::mesh::Entity *> &entities)
void write_output_db(Ioss::Region &io_region, const stk_classic::mesh::BulkData &bulk, const stk_classic::mesh::Selector *anded_selector)
void process_input_request(MeshData &mesh_data, stk_classic::mesh::BulkData &bulk, double time)
Field base class with an anonymous data type and anonymous multi-dimension.
void create_output_mesh(const std::string &filename, stk_classic::ParallelMachine comm, stk_classic::mesh::BulkData &bulk_data, MeshData &mesh_data, bool lower_case_variable_names)
void field_data_from_ioss(const stk_classic::mesh::FieldBase *field, std::vector< stk_classic::mesh::Entity *> &entities, Ioss::GroupingEntity *io_entity, const std::string &io_fld_name)
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...
void define_output_db(Ioss::Region &io_region, const mesh::BulkData &bulk_data, const Ioss::Region *input_region, const stk_classic::mesh::Selector *anded_selector, const bool sort_stk_parts)
This is a class for selecting buckets based on a set of meshparts and set logic.
void populate_bulk_data(stk_classic::mesh::BulkData &bulk_data, MeshData &mesh_data)
const std::vector< Bucket * > & buckets(EntityRank rank) const
Query all buckets of a given entity rank.
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.
bool include_entity(const Ioss::GroupingEntity *entity)
Entity * get_entity(EntityRank entity_rank, EntityId entity_id) const
Get entity with a given key.
void define_input_fields(MeshData &mesh_data, stk_classic::mesh::fem::FEMMetaData &fem_meta)
Field with defined data type and multi-dimensions (if any)
An application-defined subset of a problem domain.
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...
void default_part_processing(const std::vector< T *> &entities, stk_classic::mesh::fem::FEMMetaData &fem_meta)
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...
bool modification_end()
Parallel synchronization of modifications and transition to the guaranteed parallel consistent state...
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.
bool is_part_io_part(stk_classic::mesh::Part &part)
const std::string & name() const
Application-defined text name of this part.
void define_output_fields(const MeshData &mesh_data, const stk_classic::mesh::fem::FEMMetaData &fem_meta, bool add_all_fields)
void get_element_block_sizes(MeshData &mesh_data, std::vector< INT > &el_blocks)
void get_entities(const BulkData &mesh, EntityRank entity_rank, std::vector< Entity *> &entities)
Get all entities of the specified type, sorted by ID.
const stk_classic::mesh::Field< double, stk_classic::mesh::ElementNode > * get_distribution_factor_field(const stk_classic::mesh::Part &p)
Manager for an integrated collection of entities, entity relations, and buckets of field data...
void create_input_mesh(const std::string &mesh_type, const std::string &mesh_filename, stk_classic::ParallelMachine comm, stk_classic::mesh::fem::FEMMetaData &fem_meta, stk_classic::io::MeshData &mesh_data, bool lower_case_variable_names)
const std::string & name() const
Application-defined text name of this field.
A fundamental unit within the discretization of a problem domain, including but not limited to nodes...
void field_data_to_ioss(const stk_classic::mesh::FieldBase *field, std::vector< stk_classic::mesh::Entity *> &entities, Ioss::GroupingEntity *io_entity, const std::string &io_fld_name, Ioss::Field::RoleType filter_role)
void set_field_role(stk_classic::mesh::FieldBase &f, const Ioss::Field::RoleType &role)
void process_mesh_bulk_data(Ioss::Region *region, stk_classic::mesh::BulkData &bulk_data)
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_classic::mesh::Part &part, const stk_classic::mesh::EntityRank part_type, Ioss::GroupingEntity *entity, const Ioss::Field::RoleType filter_role, const bool add_all)
void input_mesh_fields(Ioss::Region *region, stk_classic::mesh::BulkData &bulk, double time)
std::vector< Part *> PartVector
Collections of parts are frequently maintained as a vector of Part pointers.
void define_io_fields(Ioss::GroupingEntity *entity, Ioss::Field::RoleType role, stk_classic::mesh::Part &part, stk_classic::mesh::EntityRank part_type)
EntityRank entity_rank(const EntityKey &key)
Given an entity key, return an entity type (rank).
Entity & declare_element_side(Entity &elem, Entity &side, const unsigned local_side_id, Part *part)
Create (or find) an element side.
void set_distribution_factor_field(stk_classic::mesh::Part &p, const stk_classic::mesh::Field< double, stk_classic::mesh::ElementNode > &df_field)
int process_output_request(MeshData &mesh_data, stk_classic::mesh::BulkData &bulk, double time, const std::set< const stk_classic::mesh::Part *> &exclude)