-
Notifications
You must be signed in to change notification settings - Fork 42
Add interface for topography models. #814
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
base: main
Are you sure you want to change the base?
Conversation
MFraters
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am on two minds about the naming of the class. Originally I thought just naming it none, to indicate that there is no topography. But uniform, with a default of zero would also work. Opinions?
gassmoeller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the structure looks correct to me, but I have a number of suggestions for naming and you will have to update a bunch of comments.
|
|
||
| /** | ||
| * Whether to consider a reference or deformed surface. | ||
| */ | ||
| const std::string surface_type = "reference_surface"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while a string is flexible, it is also quite expensive to use. In addition it could contain arbitrary new values. I would suggest to introduce an enum type in the public part of this class (or even outside the class, but inside the Topography namespace. Something like:
enum SurfaceType
{
reference_surface,
deformed_surface};
This also guarantees that only these two values can be used.
| "Uniform gravity model. It returns the gravity vector in a Cartesian coordinate system at " | ||
| "a given position, which has a constant magitude for the whole domain. The vector points " | ||
| "down in cartesian coordinates and to the center of the sphere in spherical coordinates."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nothing is parsed below so nothing needs to be declared here either?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the declaration.
|
Hi both, I think I've addressed all the previous comments. Next I think I'll need to add a case 7 to world.cc and make sure calling get_topography will return 0 and that I can also return the correct surface type with the get_surface_type function. |
Apply suggestions from code review Co-authored-by: Rene Gassmoeller <[email protected]> Address comments. minor changes
| * A pointers to the topography model. This variable is responsible for | ||
| * the topography model and has ownership over it. Therefore a unique | ||
| * pointer are used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a random comment as I'm looking at PRs to see what everyone has been working on :)
| * A pointers to the topography model. This variable is responsible for | |
| * the topography model and has ownership over it. Therefore a unique | |
| * pointer are used. | |
| * A pointer to the topography model. This variable is responsible for | |
| * the topography model and has ownership over it. Therefore a unique | |
| * pointer is used. |
| SurfaceType surface_type; | ||
|
|
||
| /** | ||
| * declare and read in the world builder file into the parameters class |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment doesn't seem right?
| get_surface_type() = 0; | ||
|
|
||
| /** | ||
| * Returns a temperature based on the given position, depth in the model, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * Returns a temperature based on the given position, depth in the model, | |
| * Returns a topography based on the given position, depth in the model, |
| * declare and read in the world builder file into the topography class | ||
| */ | ||
| static | ||
| void declare_entries(Parameters &prm, const std::string &parent_name = ""); | ||
|
|
||
| /** | ||
| * declare and read in the world builder file into the topography class | ||
| */ | ||
| void parse_entries(Parameters &prm) override final; | ||
|
|
||
| /** | ||
| * declare and read in the world builder file into the topography class |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These comments are all the same, which makes them less informative. Maybe make them more specific to the functions?
gassmoeller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some comments from my previous review are not addressed yet. but generally closer to being ready.
| namespace Topography | ||
| { | ||
| class Interface; | ||
| } // namespace GravityModel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Topography
| std::unique_ptr<WorldBuilder::GravityModel::Interface> gravity_model; | ||
|
|
||
| /** | ||
| * A pointers to the topography model. This variable is responsible for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pointers -> pointer
| /** | ||
| * A pointers to the topography model. This variable is responsible for | ||
| * the topography model and has ownership over it. Therefore a unique | ||
| * pointer are used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * pointer are used. | |
| * pointer is used. |
| * A pointers to the topography model. This variable is responsible for | ||
| * the topography model and has ownership over it. Therefore a unique | ||
| * pointer are used. | ||
| * @see CoordinateSystem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are you referring to here?
| deformed_surface | ||
| }; | ||
|
|
||
| SurfaceType surface_type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this variable private. The enum type needs to be public, so that calling functions know that this type exists. But the variable itself (surface_type) should still be private as before so that no one accidentally changes this variable and all access has to go through get_surface_type.
Also add documentation what this variable means.
| { | ||
| /** | ||
| * This implements a minimum depth topography. The minimum depth topography | ||
| * finds the minimum depth of a feature and uses that for the topography. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * finds the minimum depth of a feature and uses that for the topography. | |
| * finds the minimum depth of all active features at a location and uses that depth as the topography. |
|
|
||
|
|
||
|
|
||
| WorldBuilder::grains |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you delete these lines?
| double | ||
| Uniform::get_topography(const Point<3> &/*position*/, | ||
| const Objects::NaturalCoordinate &/*position_in_natural_coordinates*/, | ||
| const double /*depth*/) const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you expect the depth to be needed? Do you forsee that the returned topography would be different based on the depth?
| const Objects::NaturalCoordinate &/*position_in_natural_coordinates*/, | ||
| const double /*depth*/) const | ||
| { | ||
| return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uniform does not mean zero, it just means it is the same everywhere. could you make this variable?
MFraters
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started playing a little bit with it already and I am wondering why we choice the approach of making this one global plugin system for the whole model, instead of a plugin system per feature. I could for example imagine that for different features you might want to have different types of topography, for example on a continent use a digital elevation map and/or different elevation maps for different regions, while in the ocean use fpr exaple a isostatic equilibrium or a analytical solution from the half space cooling or plate model. Do you remember why we went for this approach?
Here is adding the interface for having topography models and defining them in the .wb file. So far the model is named uniform, though I think this will be changed later on to something better fitted to the lowest feature topography model.
Next steps would be: