-
Notifications
You must be signed in to change notification settings - Fork 28
/
oceanic_plate.h
158 lines (136 loc) · 5.93 KB
/
oceanic_plate.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/*
Copyright (C) 2018-2024 by the authors of the World Builder code.
This file is part of the World Builder.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef WORLD_BUILDER_FEATURES_OCEANIC_PLATE_H
#define WORLD_BUILDER_FEATURES_OCEANIC_PLATE_H
#include "world_builder/features/interface.h"
#include "world_builder/objects/surface.h"
namespace WorldBuilder
{
class Parameters;
class World;
namespace Features
{
namespace OceanicPlateModels
{
namespace Composition
{
class Interface;
} // namespace Composition
namespace Grains
{
class Interface;
} // namespace Grains
namespace Temperature
{
class Interface;
} // namespace Temperature
} // namespace OceanicPlateModels
/**
* This class represents a oceanic plate and can implement submodules
* for temperature and composition. These submodules determine what
* the returned temperature or composition of the temperature and composition
* functions of this class will be.
*/
class OceanicPlate final: public Interface
{
public:
/**
* constructor
*/
OceanicPlate(WorldBuilder::World *world);
/**
* Destructor
*/
~OceanicPlate() override final;
/**
* declare and read in the world builder file into the parameters class
*/
static
void declare_entries(Parameters &prm,
const std::string &parent_name = "",
const std::vector<std::string> &required_entries = {});
/**
* Produce a JSON snippet for the schema
*/
static
void make_snippet(Parameters &prm);
/**
* declare and read in the world builder file into the parameters class
*/
void parse_entries(Parameters &prm) override final;
/**
* Returns different values at a single point in one go stored in a vector of doubles.
*
* The properties input decides what each entry means, and the output is generated in the
* same order as the properties input. The properties input consists of
* a 3D array, where the first entry identifies the property and the last two entries
* provide extra information about that property.
*
* Temperature is identified by 1 and no extra information is needed. So temperature
* input usually looks like {1,0,0}. A temperature query prodoces one entry in the output
* vector.
*
* Composition is identified by 2. This produces one
* value in the output. The second entry identifies the composition number and the third
* number is not used. So a commposition query asking about composition 1 looks like this:
* {2,1,0}. A composition query prodoces one entry in the output vector.
*
* Grains are identified by 2. The second entry is the grain composition number and the third
* entry is the number of grains. A query about the grains, where it asks about composition 1
* (for example enstatite) and 500 grains, looks like this: {2,1,500}.
* A composition query prodoces n_grains*10 entries in the output vector. The first n_grains
* entries are the sizes of all the grains, and the other 9 entries are sets of rotation
* matrices. The rotation matrix entries are ordered [0][0],[0][1],[0][2],[1][0],[1][1],etc.
*
* The entries in output variable relates the index of the property to the index in the output.
*/
void
properties(const Point<3> &position_in_cartesian_coordinates,
const Objects::NaturalCoordinate &position_in_natural_coordinates,
const double depth,
const std::vector<std::array<unsigned int,3>> &properties,
const double gravity,
const std::vector<size_t> &entry_in_output,
std::vector<double> &output) const override final;
private:
/**
* A vector containing all the pointers to the temperature models. This vector is
* responsible for the features and has ownership over them. Therefore
* unique pointers are used.
* @see Features
*/
std::vector<std::unique_ptr<Features::OceanicPlateModels::Temperature::Interface> > temperature_models;
/**
* A vector containing all the pointers to the composition models. This vector is
* responsible for the features and has ownership over them. Therefore
* unique pointers are used.
* @see Features
*/
std::vector<std::unique_ptr<Features::OceanicPlateModels::Composition::Interface> > composition_models;
/**
* A vector containing all the pointers to the grains models. This vector is
* responsible for the features and has ownership over them. Therefore
* unique pointers are used.
* @see Features
*/
std::vector<std::unique_ptr<Features::OceanicPlateModels::Grains::Interface> > grains_models;
double min_depth;
Objects::Surface min_depth_surface;
double max_depth;
Objects::Surface max_depth_surface;
};
} // namespace Features
} // namespace WorldBuilder
#endif