World Builder  1.1.0-pre
A geodynamic initial conditions generator
point.h
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 
20 #ifndef WORLD_BUILDER_TYPES_POINT_H
21 #define WORLD_BUILDER_TYPES_POINT_H
22 
23 
24 #include "world_builder/point.h"
26 
27 
28 namespace WorldBuilder
29 {
30  class Parameters;
31 
32  namespace Types
33  {
34 
41  template <unsigned int dim>
42  class Point final: public Interface
43  {
44  public:
45 
49  Point();
50 
55 
60 
64  Point(Point const &other);
65 
69  ~Point() override final;
70 
74  void write_schema(Parameters &prm,
75  const std::string &name,
76  const std::string &documentation) const override final;
77 
81  double operator*(const Point<dim> &point) const;
82 
83 
87  WorldBuilder::Point<dim> operator*(const double scalar) const;
88 
92  WorldBuilder::Point<dim> operator+(const Point<dim> &point) const;
93 
94 
98  WorldBuilder::Point<dim> operator-(const Point<dim> &point) const;
99 
103  const double &operator[](const unsigned int index) const;
104 
105 
109  double &operator[](const unsigned int index);
110 
111 
112 
115  std::string description;
116 
117  protected:
118  Point *clone_impl() const override final
119  {
120  return new Point(*this);
121  };
122 
123  private:
124 
125  };
126 
127  template<unsigned int dim>
128  WorldBuilder::Point<dim> operator*(const double scalar, const Point<dim> &point);
129  } // namespace Types
130 } // namespace WorldBuilder
131 
132 #endif
double operator*(const Point< dim > &point) const
Definition: point.cc:96
~Point() override final
WorldBuilder::Point< dim > default_value
Definition: point.h:114
std::string description
Definition: point.h:115
Point * clone_impl() const override final
Definition: point.h:118
WorldBuilder::Point< dim > value
Definition: point.h:113
void write_schema(Parameters &prm, const std::string &name, const std::string &documentation) const override final
Definition: point.cc:78