Page MenuHomec4science

lm_defaults.cc
No OneTemporary

File Metadata

Created
Mon, Nov 4, 04:12

lm_defaults.cc

#include "lm_defaults.hh"
#include "compute_impulse.hh"
#include "cube_surface.hh"
#include "lm_type_caster.hh"
__BEGIN_LIBMULTISCALE__
/* -------------------------------------------------------------------------- */
#define ARG(...) __VA_ARGS__
#define DECLARE_ASSIGN(T) \
template <> \
std::enable_if_t<!std::is_same<T, pybind11::object>::value> assign_value<T>( \
T & to_set, pybind11::object val) { \
Assign<T>::doit(to_set, pybind11::cast<T>(val)); \
}
DECLARE_ASSIGN(ARG(std::vector<FieldType>));
DECLARE_ASSIGN(ARG(PhysicalScalar<Length, Real>));
DECLARE_ASSIGN(ARG(PhysicalScalar<Mass, Real>));
DECLARE_ASSIGN(ARG(PhysicalScalar<Energy, Real>));
DECLARE_ASSIGN(ARG(PhysicalScalar<Time, Real>));
DECLARE_ASSIGN(ARG(PhysicalScalar<MassDensity, Real>));
DECLARE_ASSIGN(ARG(PhysicalScalar<Force, Real>));
DECLARE_ASSIGN(ARG(PhysicalScalar<Pressure, Real>));
DECLARE_ASSIGN(ARG(PhysicalScalar<Temperature, Real>));
DECLARE_ASSIGN(ARG(Quantity<Length, 1u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Mass, 1u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Energy, 1u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Time, 1u, Real>));
DECLARE_ASSIGN(ARG(Quantity<MassDensity, 1u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Force, 1u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Pressure, 1u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Temperature, 1u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Length, 2u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Mass, 2u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Energy, 2u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Time, 2u, Real>));
DECLARE_ASSIGN(ARG(Quantity<MassDensity, 2u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Force, 2u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Pressure, 2u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Temperature, 2u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Length, 3u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Mass, 3u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Energy, 3u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Time, 3u, Real>));
DECLARE_ASSIGN(ARG(Quantity<MassDensity, 3u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Force, 3u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Pressure, 3u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Temperature, 3u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Length, 6u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Mass, 6u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Energy, 6u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Time, 6u, Real>));
DECLARE_ASSIGN(ARG(Quantity<MassDensity, 6u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Force, 6u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Pressure, 6u, Real>));
DECLARE_ASSIGN(ARG(Quantity<Temperature, 6u, Real>));
DECLARE_ASSIGN(ARG(Vector<1u, UInt>));
DECLARE_ASSIGN(ARG(Vector<2u, UInt>));
DECLARE_ASSIGN(ARG(Vector<3u, UInt>));
DECLARE_ASSIGN(ARG(Vector<1u>));
DECLARE_ASSIGN(ARG(Vector<2u>));
DECLARE_ASSIGN(ARG(Vector<3u>));
DECLARE_ASSIGN(CubeSurface::Face);
DECLARE_ASSIGN(Operator);
DECLARE_ASSIGN(DOFType);
DECLARE_ASSIGN(int);
DECLARE_ASSIGN(char);
DECLARE_ASSIGN(long);
DECLARE_ASSIGN(bool);
DECLARE_ASSIGN(UInt);
DECLARE_ASSIGN(std::string);
DECLARE_ASSIGN(Real);
DECLARE_ASSIGN(std::vector<int>);
DECLARE_ASSIGN(std::vector<UInt>);
DECLARE_ASSIGN(std::vector<std::string>);
DECLARE_ASSIGN(Impulse::ImpulseType);
DECLARE_ASSIGN(IntegrationSchemeMask);
DECLARE_ASSIGN(UnitSystem);
DECLARE_ASSIGN(FieldType);
// DECLARE_ASSIGN(ARG(std::map<std::string, ArgumentContainer *>))
#undef DECLARE_ASSIGN
#define DECLARE_ASSIGN(type, Dim) \
template <> \
std::enable_if_t<!std::is_same<type[Dim], pybind11::object>::value> \
assign_value<type[Dim]>(type(&to_set)[Dim], pybind11::object val) { \
type l[Dim]; \
std::vector<type> vec = pybind11::cast<std::vector<type>>(val); \
for (UInt i = 0; i < Dim; ++i) \
l[i] = vec[i]; \
assign_value(to_set, l); \
}
DECLARE_ASSIGN(bool, 3);
DECLARE_ASSIGN(Real, 3);
DECLARE_ASSIGN(Real, 2);
DECLARE_ASSIGN(int, 6);
DECLARE_ASSIGN(int, 3);
DECLARE_ASSIGN(std::string, 2);
DECLARE_ASSIGN(std::string, 3);
#undef DECLARE_ASSIGN
#undef ARG
UInt _parse(std::map<std::string, ArgumentContainer *> &inputs,
std::stringstream &line, UInt n_entries);
template <>
std::enable_if_t<!std::is_same<std::map<std::string, ArgumentContainer *>,
pybind11::object>::value>
assign_value<std::map<std::string, ArgumentContainer *>>(
std::map<std::string, ArgumentContainer *> &to_set, pybind11::object val) {
std::string input = pybind11::cast<std::string>(val);
std::stringstream sstr(input);
_parse(to_set, sstr, 1);
}
/* -------------------------------------------------------------------------- */
template <>
std::enable_if_t<!std::is_arithmetic<pybind11::object>::value, UInt>
_parse(pybind11::object &val, std::stringstream &line, UInt n_entries){
LM_FATAL("cannot pass a pybind object in from LM parser");
}
/* -------------------------------------------------------------------------- */
__END_LIBMULTISCALE__

Event Timeline