Commit e828b4e9 authored by Mark Meredith's avatar Mark Meredith
Browse files

Cleanup

parent b6174f67
Loading
Loading
Loading
Loading
Loading

include/solver.hpp

deleted100644 → 0
+0 −70
Original line number Diff line number Diff line
#ifndef SOLVER_H_
#define SOLVER_H_

#include <array>
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <variant>
#include <vector>

#include <solver_inputs.hpp>

namespace solver {

using NumberArray = std::vector<double>;
using StringArray = std::vector<std::string>;
using Array = std::variant<NumberArray, StringArray>;
using InputInfo = std::map<std::string, Array>;

std::optional<InputInfo> parse_inputs(std::string);

struct GeometryAxis {
  double low;
  double high;
  bool periodic;
};
struct GeometrySettings {
  std::array<GeometryAxis, 3> axes;
  std::string csg_filename;
};

struct MeshAxis {
  unsigned int fluid_max_tile_size;
  unsigned int max_grid_size;
  unsigned int n_cell;
  unsigned int particle_max_grid_size;
  unsigned int particle_max_tile_size;
};

struct MeshSettings {
  int blocking_factor;
  double small_volfrac;
  std::array<MeshAxis, 3> axes;
};
struct TimeSettings {
  bool fixed_dt;
  double cfl;
  double dt_max;
  double dt_min;
  double tcoll_ratio;
  double tstop;
  unsigned int max_step;
};
struct SolverSettings {
  GeometrySettings geometry;
  MeshSettings mesh;
  TimeSettings time;
};

struct InputsMessage {
  std::string message;
};
std::pair<solver::SolverSettings, std::vector<InputsMessage>>
    make_solver(solver::InputInfo);
std::string serialize(solver::SolverSettings);

} // namespace solver

#endif

src/solver_impl.hpp

deleted100644 → 0
+0 −12
Original line number Diff line number Diff line
#include <solver.hpp>

namespace solver {
std::pair<solver::GeometrySettings, std::vector<InputsMessage>>
    make_geometry(solver::InputInfo);
std::pair<solver::MeshSettings, std::vector<InputsMessage>>
    make_mesh(solver::InputInfo);
std::pair<solver::TimeSettings, std::vector<InputsMessage>>
    make_time(solver::InputInfo);
void add_missing_msg(std::string key, std::vector<InputsMessage> &, Array);
void add_msg(std::string key, std::vector<InputsMessage> &, Array);
} // namespace solver

src/solver_inputs.hpp

deleted100644 → 0
+0 −32
Original line number Diff line number Diff line
#ifndef INPUTS_H_
#define INPUTS_H_

// Geometry
static const std::string DT_MAX("mfix.dt_max");
static const std::string DT_MIN("mfix.dt_min");
static const std::string PERIODIC("geometry.is_periodic");
static const std::string PROB_HI("geometry.prob_hi");
static const std::string PROB_LO("geometry.prob_lo");
static const std::string CSG_FILENAME("mfix.geometry_filename");

// Mesh
static const std::string BLOCKING_FACTOR("amr.blocking_factor");
static const std::string FABARRAY_TILE_SZ("fabarray.mfiter_tile_size");
static const std::string GRID_SIZE_X("amr.max_grid_size_x");
static const std::string GRID_SIZE_Y("amr.max_grid_size_y");
static const std::string GRID_SIZE_Z("amr.max_grid_size_z");
static const std::string N_CELL("amr.n_cell");
static const std::string PARTICLE_GRID_SIZE_X("particles.max_grid_size_x");
static const std::string PARTICLE_GRID_SIZE_Y("particles.max_grid_size_y");
static const std::string PARTICLE_GRID_SIZE_Z("particles.max_grid_size_z");
static const std::string PARTICLE_TILE_SZ("particles.tile_size");
static const std::string SMALL_VOLFRAC("eb2.small_volfrac");

// Time
static const std::string CFL("mfix.cfl");
static const std::string FIXED_DT("mfix.fixed_dt");
static const std::string MAXSTEP("mfix.max_step");
static const std::string TCOLL_RATIO("mfix.tcoll_ratio");
static const std::string TSTOP("mfix.stop_time");

#endif