Loading CMakeLists.txt +3 −3 Original line number Diff line number Diff line cmake_minimum_required(VERSION 3.14) project(MFIX-Parser DESCRIPTION "Parser for CSG files for MFiX-Exa" HOMEPAGE_URL "https://mfix.netl.doe.gov/gitlab/exa/mfix-parser" project(CSG-EB DESCRIPTION "Parser for CSG files to define Embedded Boundaries" HOMEPAGE_URL "https://mfix.netl.doe.gov/gitlab/exa/csg-eb" LANGUAGES CXX ) Loading README.md +1 −3 Original line number Diff line number Diff line # mfix-parser # csg-eb Repo for parsing and validating MFIX input(s) files for use by mfix-app. Uses PEGTL for parsing and Catch2 for tests. This has the MFIX-Exa repo as a submodule in order to test against existing ``inputs`` files. ## Build Loading meson.build +2 −3 Original line number Diff line number Diff line project('mfix-parser', 'cpp', project('csg-eb', 'cpp', version : '0.1', default_options : [ 'warning_level=3', Loading @@ -15,10 +15,9 @@ cgal = dependency('cgal', method: 'pkg-config') parser_inc = include_directories('include', 'src') subdir('src/csg') subdir('src/inputs') parser_dep = declare_dependency( include_directories: parser_inc, link_with: [lib_csg_parser, lib_inputs_parser], link_with: lib_csg_parser, dependencies: [cgal], ) src/inputs/geometry.cppdeleted 100644 → 0 +0 −58 Original line number Diff line number Diff line #include "solver.hpp" #include "solver_impl.hpp" namespace solver { std::pair<solver::GeometrySettings, std::vector<InputsMessage>> make_geometry(solver::InputInfo ii) { std::vector<InputsMessage> messages; solver::GeometrySettings geo; geo.csg_filename = ""; if (!ii.count(CSG_FILENAME)) { add_missing_msg(CSG_FILENAME, messages, std::vector<std::string>{""}); } else { auto csg_filename = std::get<solver::StringArray>(ii[CSG_FILENAME]); if (csg_filename.size() != 1) { add_msg(CSG_FILENAME, messages, std::vector<std::string>{""}); } else { geo.csg_filename = csg_filename[0]; } } if (!ii.count(PROB_LO)) { add_missing_msg(PROB_LO, messages, std::vector<double>{}); } if (!ii.count(PROB_HI)) { add_missing_msg(PROB_HI, messages, std::vector<double>{}); } if (!ii.count(PERIODIC)) { add_missing_msg(PERIODIC, messages, std::vector<double>{0, 0, 0}); } auto lows = std::get<solver::NumberArray>(ii[PROB_LO]); auto highs = std::get<solver::NumberArray>(ii[PROB_HI]); auto is_periodic = std::get<solver::NumberArray>(ii[PERIODIC]); if (lows.size() != 3) { add_msg(PROB_LO, messages, std::vector<double>{0, 0, 0}); } else { std::get<0>(geo.axes).low = lows[0]; std::get<1>(geo.axes).low = lows[1]; std::get<2>(geo.axes).low = lows[2]; } if (highs.size() != 3) { add_msg(PROB_HI, messages, std::vector<double>{0, 0, 0}); } else { std::get<0>(geo.axes).high = highs[0]; std::get<1>(geo.axes).high = highs[1]; std::get<2>(geo.axes).high = highs[2]; } if (is_periodic.size() != 3) { add_msg(PERIODIC, messages, std::vector<double>{0, 0, 0}); } else { std::get<0>(geo.axes).periodic = is_periodic[0]; std::get<1>(geo.axes).periodic = is_periodic[1]; std::get<2>(geo.axes).periodic = is_periodic[2]; } return std::make_pair(geo, messages); } } // namespace solver src/inputs/mesh.cppdeleted 100644 → 0 +0 −106 Original line number Diff line number Diff line #include "solver.hpp" #include "solver_impl.hpp" namespace solver { std::pair<solver::MeshSettings, std::vector<InputsMessage>> make_mesh(solver::InputInfo ii) { std::vector<InputsMessage> messages; solver::MeshSettings mesh; auto [mx, my, mz] = mesh.axes; if (!ii.count(N_CELL)) { // NumberArray defaults = std::vector<double> {0}; add_msg(N_CELL, messages, std::vector<double>{}); } else { auto n_cell = std::get<solver::NumberArray>(ii[N_CELL]); if (n_cell.size() != 3) { add_msg(N_CELL, messages, std::vector<double>{0, 0, 0}); } else { mx.n_cell = n_cell[0]; my.n_cell = n_cell[1]; mz.n_cell = n_cell[2]; } } auto fabarray_size = std::get<solver::NumberArray>(ii[FABARRAY_TILE_SZ]); if (fabarray_size.size() != 3) { add_msg(FABARRAY_TILE_SZ, messages, std::vector<double>{0, 0, 0}); } else { mx.fluid_max_tile_size = fabarray_size[0]; my.fluid_max_tile_size = fabarray_size[1]; mz.fluid_max_tile_size = fabarray_size[2]; } auto part_grid_size = std::get<solver::NumberArray>(ii[PARTICLE_TILE_SZ]); if (part_grid_size.size() != 3) { add_msg(PARTICLE_TILE_SZ, messages, std::vector<double>{0, 0, 0}); } else { mx.particle_max_tile_size = part_grid_size[0]; my.particle_max_tile_size = part_grid_size[1]; mz.particle_max_tile_size = part_grid_size[2]; } auto grid_size_x = std::get<solver::NumberArray>(ii[GRID_SIZE_X]); if (grid_size_x.size() != 1) { add_msg(GRID_SIZE_X, messages, std::vector<double>{0}); } else { mx.max_grid_size = grid_size_x[0]; } auto grid_size_y = std::get<solver::NumberArray>(ii[GRID_SIZE_Y]); if (grid_size_y.size() != 1) { add_msg(GRID_SIZE_Y, messages, std::vector<double>{0}); } else { my.max_grid_size = grid_size_y[0]; } auto grid_size_z = std::get<solver::NumberArray>(ii[GRID_SIZE_Z]); if (grid_size_z.size() != 1) { add_msg(GRID_SIZE_Z, messages, std::vector<double>{0}); } else { mz.max_grid_size = grid_size_z[0]; } auto particle_grid_size_x = std::get<solver::NumberArray>(ii[PARTICLE_GRID_SIZE_X]); if (particle_grid_size_x.size() != 1) { add_msg(PARTICLE_GRID_SIZE_X, messages, std::vector<double>{0}); } else { mx.particle_max_grid_size = particle_grid_size_x[0]; } auto particle_grid_size_y = std::get<solver::NumberArray>(ii[PARTICLE_GRID_SIZE_Y]); if (particle_grid_size_y.size() != 1) { add_msg(PARTICLE_GRID_SIZE_Y, messages, std::vector<double>{0}); } else { my.particle_max_grid_size = particle_grid_size_y[0]; } auto particle_grid_size_z = std::get<solver::NumberArray>(ii[PARTICLE_GRID_SIZE_Z]); if (particle_grid_size_z.size() != 1) { add_msg(PARTICLE_GRID_SIZE_Z, messages, std::vector<double>{0}); } else { mz.particle_max_grid_size = particle_grid_size_z[0]; } auto bf = std::get<solver::NumberArray>(ii[BLOCKING_FACTOR]); if (bf.size() != 1) { add_msg(BLOCKING_FACTOR, messages, std::vector<double>{0}); } else { mesh.blocking_factor = bf[0]; } auto volfrac = std::get<solver::NumberArray>(ii[SMALL_VOLFRAC]); if (volfrac.size() != 1) { add_msg(SMALL_VOLFRAC, messages, std::vector<double>{0}); } else { mesh.small_volfrac = volfrac[0]; } mesh.axes[0] = mx; mesh.axes[1] = my; mesh.axes[2] = mz; return std::make_pair(mesh, messages); } } // namespace solver Loading
CMakeLists.txt +3 −3 Original line number Diff line number Diff line cmake_minimum_required(VERSION 3.14) project(MFIX-Parser DESCRIPTION "Parser for CSG files for MFiX-Exa" HOMEPAGE_URL "https://mfix.netl.doe.gov/gitlab/exa/mfix-parser" project(CSG-EB DESCRIPTION "Parser for CSG files to define Embedded Boundaries" HOMEPAGE_URL "https://mfix.netl.doe.gov/gitlab/exa/csg-eb" LANGUAGES CXX ) Loading
README.md +1 −3 Original line number Diff line number Diff line # mfix-parser # csg-eb Repo for parsing and validating MFIX input(s) files for use by mfix-app. Uses PEGTL for parsing and Catch2 for tests. This has the MFIX-Exa repo as a submodule in order to test against existing ``inputs`` files. ## Build Loading
meson.build +2 −3 Original line number Diff line number Diff line project('mfix-parser', 'cpp', project('csg-eb', 'cpp', version : '0.1', default_options : [ 'warning_level=3', Loading @@ -15,10 +15,9 @@ cgal = dependency('cgal', method: 'pkg-config') parser_inc = include_directories('include', 'src') subdir('src/csg') subdir('src/inputs') parser_dep = declare_dependency( include_directories: parser_inc, link_with: [lib_csg_parser, lib_inputs_parser], link_with: lib_csg_parser, dependencies: [cgal], )
src/inputs/geometry.cppdeleted 100644 → 0 +0 −58 Original line number Diff line number Diff line #include "solver.hpp" #include "solver_impl.hpp" namespace solver { std::pair<solver::GeometrySettings, std::vector<InputsMessage>> make_geometry(solver::InputInfo ii) { std::vector<InputsMessage> messages; solver::GeometrySettings geo; geo.csg_filename = ""; if (!ii.count(CSG_FILENAME)) { add_missing_msg(CSG_FILENAME, messages, std::vector<std::string>{""}); } else { auto csg_filename = std::get<solver::StringArray>(ii[CSG_FILENAME]); if (csg_filename.size() != 1) { add_msg(CSG_FILENAME, messages, std::vector<std::string>{""}); } else { geo.csg_filename = csg_filename[0]; } } if (!ii.count(PROB_LO)) { add_missing_msg(PROB_LO, messages, std::vector<double>{}); } if (!ii.count(PROB_HI)) { add_missing_msg(PROB_HI, messages, std::vector<double>{}); } if (!ii.count(PERIODIC)) { add_missing_msg(PERIODIC, messages, std::vector<double>{0, 0, 0}); } auto lows = std::get<solver::NumberArray>(ii[PROB_LO]); auto highs = std::get<solver::NumberArray>(ii[PROB_HI]); auto is_periodic = std::get<solver::NumberArray>(ii[PERIODIC]); if (lows.size() != 3) { add_msg(PROB_LO, messages, std::vector<double>{0, 0, 0}); } else { std::get<0>(geo.axes).low = lows[0]; std::get<1>(geo.axes).low = lows[1]; std::get<2>(geo.axes).low = lows[2]; } if (highs.size() != 3) { add_msg(PROB_HI, messages, std::vector<double>{0, 0, 0}); } else { std::get<0>(geo.axes).high = highs[0]; std::get<1>(geo.axes).high = highs[1]; std::get<2>(geo.axes).high = highs[2]; } if (is_periodic.size() != 3) { add_msg(PERIODIC, messages, std::vector<double>{0, 0, 0}); } else { std::get<0>(geo.axes).periodic = is_periodic[0]; std::get<1>(geo.axes).periodic = is_periodic[1]; std::get<2>(geo.axes).periodic = is_periodic[2]; } return std::make_pair(geo, messages); } } // namespace solver
src/inputs/mesh.cppdeleted 100644 → 0 +0 −106 Original line number Diff line number Diff line #include "solver.hpp" #include "solver_impl.hpp" namespace solver { std::pair<solver::MeshSettings, std::vector<InputsMessage>> make_mesh(solver::InputInfo ii) { std::vector<InputsMessage> messages; solver::MeshSettings mesh; auto [mx, my, mz] = mesh.axes; if (!ii.count(N_CELL)) { // NumberArray defaults = std::vector<double> {0}; add_msg(N_CELL, messages, std::vector<double>{}); } else { auto n_cell = std::get<solver::NumberArray>(ii[N_CELL]); if (n_cell.size() != 3) { add_msg(N_CELL, messages, std::vector<double>{0, 0, 0}); } else { mx.n_cell = n_cell[0]; my.n_cell = n_cell[1]; mz.n_cell = n_cell[2]; } } auto fabarray_size = std::get<solver::NumberArray>(ii[FABARRAY_TILE_SZ]); if (fabarray_size.size() != 3) { add_msg(FABARRAY_TILE_SZ, messages, std::vector<double>{0, 0, 0}); } else { mx.fluid_max_tile_size = fabarray_size[0]; my.fluid_max_tile_size = fabarray_size[1]; mz.fluid_max_tile_size = fabarray_size[2]; } auto part_grid_size = std::get<solver::NumberArray>(ii[PARTICLE_TILE_SZ]); if (part_grid_size.size() != 3) { add_msg(PARTICLE_TILE_SZ, messages, std::vector<double>{0, 0, 0}); } else { mx.particle_max_tile_size = part_grid_size[0]; my.particle_max_tile_size = part_grid_size[1]; mz.particle_max_tile_size = part_grid_size[2]; } auto grid_size_x = std::get<solver::NumberArray>(ii[GRID_SIZE_X]); if (grid_size_x.size() != 1) { add_msg(GRID_SIZE_X, messages, std::vector<double>{0}); } else { mx.max_grid_size = grid_size_x[0]; } auto grid_size_y = std::get<solver::NumberArray>(ii[GRID_SIZE_Y]); if (grid_size_y.size() != 1) { add_msg(GRID_SIZE_Y, messages, std::vector<double>{0}); } else { my.max_grid_size = grid_size_y[0]; } auto grid_size_z = std::get<solver::NumberArray>(ii[GRID_SIZE_Z]); if (grid_size_z.size() != 1) { add_msg(GRID_SIZE_Z, messages, std::vector<double>{0}); } else { mz.max_grid_size = grid_size_z[0]; } auto particle_grid_size_x = std::get<solver::NumberArray>(ii[PARTICLE_GRID_SIZE_X]); if (particle_grid_size_x.size() != 1) { add_msg(PARTICLE_GRID_SIZE_X, messages, std::vector<double>{0}); } else { mx.particle_max_grid_size = particle_grid_size_x[0]; } auto particle_grid_size_y = std::get<solver::NumberArray>(ii[PARTICLE_GRID_SIZE_Y]); if (particle_grid_size_y.size() != 1) { add_msg(PARTICLE_GRID_SIZE_Y, messages, std::vector<double>{0}); } else { my.particle_max_grid_size = particle_grid_size_y[0]; } auto particle_grid_size_z = std::get<solver::NumberArray>(ii[PARTICLE_GRID_SIZE_Z]); if (particle_grid_size_z.size() != 1) { add_msg(PARTICLE_GRID_SIZE_Z, messages, std::vector<double>{0}); } else { mz.particle_max_grid_size = particle_grid_size_z[0]; } auto bf = std::get<solver::NumberArray>(ii[BLOCKING_FACTOR]); if (bf.size() != 1) { add_msg(BLOCKING_FACTOR, messages, std::vector<double>{0}); } else { mesh.blocking_factor = bf[0]; } auto volfrac = std::get<solver::NumberArray>(ii[SMALL_VOLFRAC]); if (volfrac.size() != 1) { add_msg(SMALL_VOLFRAC, messages, std::vector<double>{0}); } else { mesh.small_volfrac = volfrac[0]; } mesh.axes[0] = mx; mesh.axes[1] = my; mesh.axes[2] = mz; return std::make_pair(mesh, messages); } } // namespace solver