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

Fix ValueAtPoints data type #652

Merged
merged 2 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1,584 changes: 1,502 additions & 82 deletions doc/world_builder_declarations.schema.json

Large diffs are not rendered by default.

2,984 changes: 2,553 additions & 431 deletions doc/world_builder_declarations_closed.md

Large diffs are not rendered by default.

3,340 changes: 2,863 additions & 477 deletions doc/world_builder_declarations_open.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions include/world_builder/types/value_at_points.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace WorldBuilder
* A constructor
*/
ValueAtPoints(const double default_value,
size_t max_values_in_array,
uint64_t max_values_in_array,
std::vector<Point<2>> default_points_ = std::vector<Point<2>>());

/**
Expand All @@ -62,7 +62,7 @@ namespace WorldBuilder
const std::string &documentation) const override final;

double default_value;
double max_values_in_array;
uint64_t max_values_in_array;
std::vector<Point<2> > default_points;

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "world_builder/types/value_at_points.h"
#include "world_builder/utilities.h"
#include "world_builder/world.h"
#include <cstdint>


namespace WorldBuilder
Expand Down Expand Up @@ -83,7 +84,7 @@ namespace WorldBuilder
"in degree Kelvin for this feature. If the model has an adiabatic gradient"
"this should be the mantle potential temperature, and T = Tad + Thalf. ");

prm.declare_entry("spreading velocity", Types::OneOf(Types::Double(0.01),Types::Array(Types::ValueAtPoints(0.01, std::numeric_limits<size_t>::max()))),
prm.declare_entry("spreading velocity", Types::OneOf(Types::Double(0.01),Types::Array(Types::ValueAtPoints(0.01, std::numeric_limits<uint64_t>::max()))),
"The spreading velocity of the plate in meter per year. "
"This is the velocity with which one side moves away from the ridge.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ namespace WorldBuilder
prm.declare_entry("bottom temperature", Types::Double(-1),
"The temperature in degree Kelvin which this feature should have");

prm.declare_entry("spreading velocity", Types::OneOf(Types::Double(0.01),Types::Array(Types::ValueAtPoints(0.01, std::numeric_limits<size_t>::max()))),
prm.declare_entry("spreading velocity", Types::OneOf(Types::Double(0.01),Types::Array(Types::ValueAtPoints(0.01, std::numeric_limits<uint64_t>::max()))),
"The spreading velocity of the plate in meter per year. "
"This is the velocity with which one side moves away from the ridge.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ namespace WorldBuilder
prm.declare_entry("density", Types::Double(3300),
"The reference density of the subducting plate in $kg/m^3$");

prm.declare_entry("plate velocity", Types::OneOf(Types::Double(0.01),Types::Array(Types::ValueAtPoints(0.01, std::numeric_limits<size_t>::max()))),
prm.declare_entry("plate velocity", Types::OneOf(Types::Double(0.01),Types::Array(Types::ValueAtPoints(0.01, std::numeric_limits<uint64_t>::max()))),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you use uint max for doubles?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That contains the max number of elements:

ValueAtPoints::ValueAtPoints(const double default_value_,
size_t max_values_in_array_,
std::vector<Point<2>> default_points_)

"The velocity with which the plate subducts in meters per year. Default is 5 cm/yr");

prm.declare_entry("coupling depth", Types::Double(100e3),
Expand Down
2 changes: 1 addition & 1 deletion source/world_builder/types/value_at_points.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace WorldBuilder
{

ValueAtPoints::ValueAtPoints(const double default_value_,
size_t max_values_in_array_,
uint64_t max_values_in_array_,
std::vector<Point<2>> default_points_)
:
default_value(default_value_),
Expand Down
Loading