Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add variable surface min max area features #396

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0173c3d
Add VAlueAtPoints and OneOf to types enum.
MFraters Mar 24, 2022
9e6f332
Add oneOf type.
MFraters Mar 24, 2022
edddada
Add value at points type.
MFraters Mar 24, 2022
88111fe
Add new folder for objects and add surface as an object.
MFraters Mar 24, 2022
602230a
Add delaunator as a header only library.
MFraters Mar 24, 2022
ed86f32
Update rapidjson mystwriter
MFraters Mar 24, 2022
ce630d4
Add option to the world builder app to convert 3D spherical coordinte…
MFraters Mar 24, 2022
2326bbf
Update KD Tree implementation.
MFraters Mar 24, 2022
efe4f12
Add to paramters a get function to retrieve value at points.
MFraters Mar 24, 2022
c860abb
Add approx function to utilities.h and add get_surface_point function…
MFraters Mar 24, 2022
5ad62aa
Add operator== for points which compares points with an epsilon.
MFraters Mar 24, 2022
e825756
remove unneeded line from plugin system.
MFraters Mar 24, 2022
eeed2c1
Add min an max surfaces to continental plates.
MFraters Mar 24, 2022
ca41a21
update markdown declarations.
MFraters Mar 24, 2022
5402d5b
Add continental_min_max_surface_spherical test.
MFraters Mar 24, 2022
dc22f1a
Add continental_min_max_surface test.
MFraters Mar 24, 2022
bd1625d
update type data and expand the unit tester.
MFraters Mar 24, 2022
f3a6e49
Add min an max surfaces to oceanic plates.
MFraters Mar 25, 2022
fc71ad2
Add oceanic_min_max_surface_spherical test.
MFraters Mar 25, 2022
ad27095
Add oceanic_min_max_surface test.
MFraters Mar 25, 2022
fe7b151
Update world builder declarations markdown files.
MFraters Mar 25, 2022
f61163c
Add min an max surfaces to mantle layers.
MFraters Mar 26, 2022
b8ce188
Add mantle_layer_min_max_surface_spherical test.
MFraters Mar 26, 2022
1615a87
Add mantle_layer_min_max_surface test.
MFraters Mar 26, 2022
6594160
Update world builder declarations markdown files for the min-max surf…
MFraters Mar 26, 2022
55b35cb
Expand and improve min max testing.
MFraters Mar 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions app/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "world_builder/assert.h"
#include "world_builder/utilities.h"
#include "world_builder/world.h"
#include "world_builder/point.h"

#ifdef WB_WITH_MPI
#include <mpi.h>
Expand Down Expand Up @@ -52,6 +53,7 @@ int main(int argc, char **argv)
unsigned int compositions = 0;
unsigned int grain_compositions = 0;
size_t number_of_grains = 0;
bool convert_spherical = false;

if (find_command_line_option(argv, argv+argc, "-h") || find_command_line_option(argv, argv+argc, "--help"))
{
Expand Down Expand Up @@ -157,11 +159,14 @@ int main(int argc, char **argv)
if (!line_i.empty() && line_i[0] == "#" && line_i[1] == "number" && line_i[2] == "of" && line_i[3] == "grains" && line_i[4] == "=")
number_of_grains = string_to_unsigned_int(line_i[5]);

if (!line_i.empty() && line_i[0] == "#" && line_i[1] == "convert" && line_i[2] == "spherical" && line_i[3] == "=" && line_i[4] == "true")
convert_spherical = true;
}

switch (dim)
{
case 2:
WBAssertThrow(!convert_spherical, "Converting to spherical values is only available in 3D.");
// set the header
std::cout << "# x z d g T ";

Expand All @@ -184,7 +189,6 @@ int main(int argc, char **argv)

WBAssertThrow(data[i].size() == dim + 2, "The file needs to contain dim + 2 entries, but contains " << data[i].size() << " entries "
" on line " << i+1 << " of the data file. Dim is " << dim << '.');

std::array<double,2> coords = {{
string_to_double(data[i][0]),
string_to_double(data[i][1])
Expand Down Expand Up @@ -236,12 +240,16 @@ int main(int argc, char **argv)
WBAssertThrow(data[i].size() == dim + 2, "The file needs to contain dim + 2 entries, but contains " << data[i].size() << " entries "
" on line " << i+1 << " of the data file. Dim is " << dim << '.');
std::array<double,3> coords = {{
string_to_double(data[i][0]),
string_to_double(data[i][1]),
string_to_double(data[i][2])
string_to_double(data[i][0]), // x or R
string_to_double(data[i][1]) *(convert_spherical ? (const_pi/180.): 1.), // y or long
string_to_double(data[i][2]) *(convert_spherical ? (const_pi/180.): 1.) // z or lat
}
};

if (convert_spherical)
{
coords = spherical_to_cartesian_coordinates(coords).get_array();
}

std::cout << data[i][0] << ' ' << data[i][1] << ' ' << data[i][2] << ' ' << data[i][3] << ' ' << data[i][4] << ' ';
std::cout << world->temperature(coords, string_to_double(data[i][3]), string_to_double(data[i][4])) << ' ';
Expand Down
Loading