13#include <fhsim/simobject/ISimObjectCreator.h>
14#include <initializer_list>
18namespace environment::wake
31template<
typename Error = std::runtime_error>
32void Require(
bool valid, ISimObjectCreator* creator,
const std::string& objectName,
const std::string& name,
const std::string& rule)
36 creator->ReportParameterError(name, rule);
37 throw Error((objectName.empty() ?
"" : objectName +
": ") + name +
" " + rule);
50inline void LogIgnoredWithoutCastWake(ISimObjectCreator* creator, std::initializer_list<const char*> names)
52 for (
const char* name : names)
53 if (creator->GetParamSize(name) > 0)
54 creator->LogParameterInfo(name,
"ignored: CastWake is not true, so this object casts no wake.");
58inline double Norm(
const double v[3])
60 return std::sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
64inline double Dot(
const double a[3],
const double b[3])
66 return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
70inline void Cross(
const double a[3],
const double b[3],
double out[3])
72 out[0] = a[1] * b[2] - a[2] * b[1];
73 out[1] = a[2] * b[0] - a[0] * b[2];
74 out[2] = a[0] * b[1] - a[1] * b[0];
78inline std::string Format(
double value)
80 std::ostringstream text;
86inline std::string FormatVector(
const double v[3])
88 return "(" + Format(v[0]) +
", " + Format(v[1]) +
", " + Format(v[2]) +
")";