12 #include <boost/program_options.hpp> 13 #include <boost/program_options/cmdline.hpp> 15 #include <stk_util/parallel/Parallel.hpp> 16 #include <stk_util/parallel/BroadcastArg.hpp> 17 #include <stk_util/environment/ProgramOptions.hpp> 18 #include <stk_util/use_cases/UseCaseEnvironment.hpp> 20 #include <stk_mesh/base/MetaData.hpp> 21 #include <stk_mesh/base/BulkData.hpp> 22 #include <stk_mesh/base/Entity.hpp> 23 #include <stk_mesh/base/Comm.hpp> 24 #include <stk_mesh/base/GetBuckets.hpp> 25 #include <stk_mesh/base/FieldData.hpp> 27 #include <stk_mesh/fem/FEMMetaData.hpp> 28 #include <stk_mesh/fem/CoordinateSystems.hpp> 30 #include <stk_io/IossBridge.hpp> 31 #include <stk_io/MeshReadWriteUtils.hpp> 33 #include <init/Ionit_Initializer.h> 34 #include <Ioss_SubSystem.h> 40 const std::string &filename,
41 const std::string &type,
42 const std::string &decomp_method,
43 int compression_level,
44 bool compression_shuffle,
48 namespace bopt = boost::program_options;
50 int main(
int argc,
char** argv)
53 std::string decomp_method =
"";
54 std::string mesh =
"";
55 std::string type =
"exodusii";
56 size_t spatial_dimension = 3;
57 int compression_level = 0;
58 bool compression_shuffle =
false;
59 int db_integer_size = 4;
64 bopt::options_description desc(
"options");
69 "working directory with trailing '/'" )
70 (
"decomposition,D", bopt::value<std::string>(&decomp_method),
71 "decomposition method" )
72 (
"mesh", bopt::value<std::string>(&mesh),
73 "mesh file. Use name of form 'gen:NxMxL' to internally generate a hex mesh of size N by M by L intervals. See GeneratedMesh documentation for more options. Can also specify a filename. The generated mesh will be output to the file 'generated_mesh.out'" )
74 (
"dimension", bopt::value<size_t>(&spatial_dimension),
"problem spatial dimension" )
75 (
"compression_level", bopt::value<int>(&compression_level),
"compression level [1..9] to use" )
76 (
"shuffle", bopt::value<bool>(&compression_shuffle),
"use shuffle filter prior to compressing data" )
77 (
"db_integer_size", bopt::value<int>(&db_integer_size),
"use 4 or 8-byte integers on output database" );
82 use_case::UseCaseEnvironment use_case_environment(&argc, &argv);
85 std::cerr <<
"\nERROR: The --mesh option is required\n";
86 std::cerr <<
"\nApplication " << desc <<
"\n";
87 std::exit(EXIT_FAILURE);
91 if (strncasecmp(
"gen:", mesh.c_str(), 4) == 0) {
92 mesh = mesh.substr(4, mesh.size());
95 if (strncasecmp(
"dof:", mesh.c_str(), 4) == 0) {
96 mesh = mesh.substr(4, mesh.size());
99 driver(use_case_environment.m_comm, spatial_dimension,
101 compression_level, compression_shuffle, db_integer_size);
108 size_t spatial_dimension,
110 const std::string &filename,
111 const std::string &type,
112 const std::string &decomp_method,
113 int compression_level,
114 bool compression_shuffle,
120 Ioss::Init::Initializer init_db;
124 stk_classic::io::MeshData mesh_data;
126 bool use_netcdf4 =
false;
127 if (!decomp_method.empty()) {
128 mesh_data.m_property_manager.add(Ioss::Property(
"DECOMPOSITION_METHOD", decomp_method));
131 if (compression_level > 0) {
132 mesh_data.m_property_manager.add(Ioss::Property(
"COMPRESSION_LEVEL", compression_level));
135 if (compression_shuffle) {
136 mesh_data.m_property_manager.add(Ioss::Property(
"COMPRESSION_SHUFFLE", 1));
140 mesh_data.m_property_manager.add(Ioss::Property(
"FILE_TYPE",
"netcdf4"));
142 if (db_integer_size == 8) {
143 mesh_data.m_property_manager.add(Ioss::Property(
"INTEGER_SIZE_DB", db_integer_size));
151 fem_meta_data.commit();
162 int timestep_count = mesh_data.m_input_region->get_property(
"state_count").get_int();
163 for (
int step=1; step <= timestep_count; step++) {
164 double time = mesh_data.m_input_region->get_state_time(step);
void process_input_request(MeshData &mesh_data, stk_classic::mesh::BulkData &bulk, double time)
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)
const std::string working_directory()
Function working_directory returns the current working directory of this application execution...
void populate_bulk_data(stk_classic::mesh::BulkData &bulk_data, MeshData &mesh_data)
void define_input_fields(MeshData &mesh_data, stk_classic::mesh::fem::FEMMetaData &fem_meta)
boost::program_options::options_description & get_options_description()
Function get_options_description is a singleton used to store the command line option descriptions fo...
void define_output_fields(const MeshData &mesh_data, const stk_classic::mesh::fem::FEMMetaData &fem_meta, bool add_all_fields)
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)
int process_output_request(MeshData &mesh_data, stk_classic::mesh::BulkData &bulk, double time, const std::set< const stk_classic::mesh::Part *> &exclude)