-
Notifications
You must be signed in to change notification settings - Fork 33
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 random_uniform_distribution_deflected to all features and enable random number seed as input #584
Add random_uniform_distribution_deflected to all features and enable random number seed as input #584
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.
Looks good. Here are some initial comments we also discussed.
include/world_builder/world.h
Outdated
/** | ||
* Todo | ||
*/ | ||
int local_seed; |
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 don't think this is needed. Can you remove this and just locally declare it as an int?
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.
Fixed this.
RandomUniformDistributionDeflected::declare_entries(Parameters &prm, const std::string & /*unused*/) | ||
{ | ||
// Document plugin and require entries if needed. | ||
// Add compositions the required parameters. |
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.
// Add compositions the required parameters. | |
// Add compositions to the required parameters. |
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.
Fixed this and some other descriptions of the feature in random_uniform_distribution_deflected
normalize_grain_sizes = prm.get_vector<bool>("normalize grain sizes"); | ||
deflections = prm.get_vector<double>("deflections"); | ||
seed = prm.get<unsigned int>("random number seed"); | ||
world->get_random_number_engine().seed(seed); |
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.
As discussed, use global one
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.
Deleted this and other use of local seed inside features
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.
The code looks good to me. Can you add tests to that all code is tested?
include/world_builder/world.h
Outdated
@@ -276,6 +276,7 @@ namespace WorldBuilder | |||
std::string interpolation; | |||
|
|||
|
|||
|
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.
could you remove this?
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.
Test added and empty line removed.
namespace Grains | ||
{ | ||
/** | ||
* This class represents a fault and can implement |
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.
Is this comment block copied from somewhere?
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, I this is copied from random_uniform_distribution.h in the same folder as a template and I made changes based on that.
const double feature_max_depth) const override final; | ||
|
||
private: | ||
// random uniform distribution deflected grains submodule parameters |
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 would delete this comment as it doesn't add any useful information.
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.
|
190e9fe
to
f78e259
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #584 +/- ##
==========================================
+ Coverage 92.83% 92.99% +0.16%
==========================================
Files 92 98 +6
Lines 6474 6856 +382
==========================================
+ Hits 6010 6376 +366
- Misses 464 480 +16
... and 4 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
e30af2a
to
9f41335
Compare
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 would propose merging this as is. Please make a follow up pull request with
- a more extensive explanation of the random number seed declare entry
- A test which is exactly the same, but has a different random number.
2915c68
into
GeodynamicWorldBuilder:main
This PR adds random_uniform_distribution_deflected texture to all features (continental plate, oceanic plate, fault, subducting plate and mantle layer), sets default global random number seed as NaN unless entered in the input file, and lets random_uniform_distribution_deflected texture take random number seeds as inputs to generate different random textures with different deflection from the center.