29 namespace CoordinateSystems
45 "A spherical coordinate system. The coordinates are (radius, longitude, latitude). " 46 "The radius is set in this plugin, the longitude extends at least from -360 to 360 degrees, " 47 "and the latitude extends from -90 to 90. It is required to choose a depth method. Please " 48 "see the manual for more information.");
52 Types::String(
"",std::vector<std::string>({
"starting point",
"begin segment",
"begin at end segment",
"continuous"})),
53 R
"(Which depth method to use in the spherical case. The available options are 'starting point', )" 54 R"('begin segment' and 'begin at end segment'. See the manual section on coordinate systems for )" 59 R
"(The radius of the sphere.)"); 69 const std::string string_depth_method = prm.
get<std::string>(
"depth method");
70 if (string_depth_method ==
"starting point")
72 else if (string_depth_method ==
"begin segment")
74 else if (string_depth_method ==
"begin at end segment")
79 WBAssertThrow(
true,
"Option " << string_depth_method <<
" is not a valid depth method for spherical " 80 "coordinates. The available options are 'starting point', 'begin segment' and 'begin at end segment'. " 81 "The option 'continuous' is not yet available.");
120 "Can not convert non spherical points through the spherical coordinate system.");
122 "Can not convert non spherical points through the spherical coordinate system.");
123 const double radius = point_1[0];
124 WBAssert((radius - point_2[0]) < std::numeric_limits<double>::epsilon() * std::max(1.0,radius),
"The radius of point 1 is not the same as the radius of point 2.");
130 return radius * std::acos(std::min(1.,std::max(0.,point_1_cart*point_2_cart/(radius*radius))));
#define WB_REGISTER_COORDINATE_SYSTEM(classname, name)
WorldBuilder::World * world
std::array< double, 3 > cartesian_to_spherical_coordinates(const Point< 3 > &position)
void parse_entries(Parameters &prm) override final
Spherical(WorldBuilder::World *world)
std::array< double, 3 > natural_to_cartesian_coordinates(const std::array< double, 3 > &position) const override final
void enter_subsection(const std::string &name)
virtual double max_model_depth() const override final
static void declare_entries(Parameters &prm, const std::string &parent_name="")
Point< 3 > spherical_to_cartesian_coordinates(const std::array< double, 3 > &scoord)
CoordinateSystem get_coordinate_system() const
const std::array< double, dim > & get_array() const
CoordinateSystem natural_coordinate_system() const override final
#define WBAssert(condition, message)
~Spherical() override final
#define WBAssertThrow(condition, message)
DepthMethod used_depth_method
DepthMethod depth_method() const override final
void declare_entry(const std::string &name, const Types::Interface &type, const std::string &documentation)
double distance_between_points_at_same_depth(const Point< 3 > &point_1, const Point< 3 > &point_2) const override final
T get(const std::string &name)
std::array< double, 3 > cartesian_to_natural_coordinates(const std::array< double, 3 > &position) const override final