all of the changes
This commit is contained in:
20
include/FluidSim/PipeSolver.hpp
Normal file
20
include/FluidSim/PipeSolver.hpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include <stdexcept>
|
||||
#include <string_view>
|
||||
namespace fluidsim::port {
|
||||
enum class PipeSolver { Rusanov, Hlle, Hllc };
|
||||
inline const char* pipe_solver_name(PipeSolver solver) {
|
||||
switch(solver) {
|
||||
case PipeSolver::Rusanov: return "rusanov";
|
||||
case PipeSolver::Hlle: return "hlle";
|
||||
case PipeSolver::Hllc: return "hllc";
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
inline PipeSolver parse_pipe_solver(std::string_view name) {
|
||||
if(name=="rusanov") return PipeSolver::Rusanov;
|
||||
if(name=="hlle") return PipeSolver::Hlle;
|
||||
if(name=="hllc") return PipeSolver::Hllc;
|
||||
throw std::invalid_argument("choose rusanov, hlle or hllc pipe solver");
|
||||
}
|
||||
} // namespace fluidsim::port
|
||||
Reference in New Issue
Block a user