World Builder  1.1.0-pre
A geodynamic initial conditions generator
cartesian.cc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2018-2024 by the authors of the World Builder code.
3 
4  This file is part of the World Builder.
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published
8  by the Free Software Foundation, either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19 
22 
23 
24 namespace WorldBuilder
25 {
26  namespace CoordinateSystems
27  {
29  {
30  this->world = world_;
31  }
32 
34  = default;
35 
36  void
37  Cartesian::declare_entries(Parameters &prm, const std::string & /*unused*/)
38  {
39  prm.declare_entry("", Types::Object(),
40  "A Cartesian coordinate system. Coordinates are (x,y,z) and extend infinitely in all directions.");
41  }
42 
43  void
45  {}
46 
47 
50  {
52  }
53 
54 
57  {
58  return DepthMethod::none;
59  }
60 
61 
62  std::array<double,3>
63  Cartesian::cartesian_to_natural_coordinates(const std::array<double,3> &position) const
64  {
65  return position;
66  }
67 
68 
69  std::array<double,3>
70  Cartesian::natural_to_cartesian_coordinates(const std::array<double,3> &position) const
71  {
72  return position;
73  }
74 
75 
76  double
78  {
80  "Can not convert non-Cartesian points through the Cartesian coordinate system.");
82  "Can not convert non-Cartesian points through the Cartesian coordinate system.");
83  // Todo: check that points are at the same depth.
84  const Point<3> difference = point_1-point_2;
85  const Point<2> point_at_depth(difference[0],difference[1], cartesian);
86 
87  return point_at_depth.norm();
88  }
89 
90 
91  double
93  {
94  return std::numeric_limits<double>::infinity();
95  }
96 
101  } // namespace CoordinateSystems
102 } // namespace WorldBuilder
103 
#define WB_REGISTER_COORDINATE_SYSTEM(classname, name)
Definition: interface.h:168
std::array< double, 3 > natural_to_cartesian_coordinates(const std::array< double, 3 > &position) const override final
Definition: cartesian.cc:70
DepthMethod depth_method() const override final
Definition: cartesian.cc:56
static void declare_entries(Parameters &prm, const std::string &parent_name="")
Definition: cartesian.cc:37
void parse_entries(Parameters &prm) override final
Definition: cartesian.cc:44
CoordinateSystem get_coordinate_system() const
Definition: point.h:403
Cartesian(WorldBuilder::World *world)
Definition: cartesian.cc:28
CoordinateSystem natural_coordinate_system() const override final
Definition: cartesian.cc:49
#define WBAssert(condition, message)
Definition: assert.h:27
double norm() const
Definition: point.h:413
virtual double max_model_depth() const override final
Definition: cartesian.cc:92
double distance_between_points_at_same_depth(const Point< 3 > &point_1, const Point< 3 > &point_2) const override final
Definition: cartesian.cc:77
void declare_entry(const std::string &name, const Types::Interface &type, const std::string &documentation)
Definition: parameters.cc:197
std::array< double, 3 > cartesian_to_natural_coordinates(const std::array< double, 3 > &position) const override final
Definition: cartesian.cc:63