-
Notifications
You must be signed in to change notification settings - Fork 38
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 interface for topography models. #814
base: main
Are you sure you want to change the base?
Conversation
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?
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 <rene.gassmoeller@mailbox.org> 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?
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
@@ -275,6 +280,14 @@ namespace WorldBuilder | |||
*/ | |||
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?
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: