-
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
Merged
gassmoeller
merged 7 commits into
GeodynamicWorldBuilder:main
from
Wang-yijun:random_number_seed
Feb 17, 2024
Merged
Add random_uniform_distribution_deflected to all features and enable random number seed as input #584
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ace099f
Fix merge issue and test with tag
Wang-yijun 10799d3
Move random number seed to initalization
Wang-yijun 3f98a39
Fix indentation
Wang-yijun a5f93db
Fix local seed type and add get function for int
Wang-yijun 7976617
Add argument for ValueAtPoints
Wang-yijun 8db24ad
Move random number seed to initalization
Wang-yijun 9f41335
Fix indentation
Wang-yijun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
115 changes: 115 additions & 0 deletions
115
..._builder/features/continental_plate_models/grains/random_uniform_distribution_deflected.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/* | ||
Copyright (C) 2018 - 2021 by the authors of the World Builder code. | ||
|
||
This file is part of the World Builder. | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published | ||
by the Free Software Foundation, either version 2 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Lesser General Public License for more details. | ||
|
||
You should have received a copy of the GNU Lesser General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef WORLD_BUILDER_FEATURES_CONTINENTAL_PLATE_MODELS_GRAINS_RANDOM_UNIFORM_DISTRIBUTION_DEFLECTED_H | ||
#define WORLD_BUILDER_FEATURES_CONTINENTAL_PLATE_MODELS_GRAINS_RANDOM_UNIFORM_DISTRIBUTION_DEFLECTED_H | ||
|
||
|
||
#include "world_builder/features/continental_plate_models/grains/interface.h" | ||
#include "world_builder/objects/surface.h" | ||
|
||
namespace WorldBuilder | ||
{ | ||
class Parameters; | ||
|
||
namespace Features | ||
{ | ||
namespace ContinentalPlateModels | ||
{ | ||
namespace Grains | ||
{ | ||
/** | ||
* This class represents a continental plate and can implement | ||
* submodules for temperature and grains. These submodules determine | ||
* what the returned temperature or grains of the temperature and grains | ||
* functions of this class will be. | ||
*/ | ||
class RandomUniformDistributionDeflected final : public Interface | ||
{ | ||
public: | ||
/** | ||
* constructor | ||
*/ | ||
RandomUniformDistributionDeflected(WorldBuilder::World *world); | ||
|
||
/** | ||
* Destructor | ||
*/ | ||
~RandomUniformDistributionDeflected() override final; | ||
|
||
/** | ||
* declare and read in the world builder file into the parameters | ||
* class | ||
*/ | ||
static void declare_entries(Parameters &prm, | ||
const std::string &parent_name = ""); | ||
|
||
/** | ||
* declare and read in the world builder file into the parameters | ||
* class | ||
*/ | ||
static void declare_grain_size_model_entries( | ||
Parameters &prm, const std::string &parent_name, | ||
const std::vector<std::string> &required_entries); | ||
|
||
/** | ||
* declare and read in the world builder file into the parameters | ||
* class | ||
*/ | ||
static void | ||
declare_fixed_size_model_entries(Parameters &prm, | ||
const std::string &parent_name = ""); | ||
|
||
/** | ||
* declare and read in the world builder file into the parameters | ||
* class | ||
*/ | ||
void parse_entries(Parameters &prm, const std::vector<Point<2>> &coordinates) override final; | ||
|
||
/** | ||
* Returns a grains based on the given position, composition (e.g. | ||
* olivine and/or enstatite)depth in the model, gravity and current grains. | ||
*/ | ||
WorldBuilder::grains | ||
get_grains(const Point<3> &position, | ||
const Objects::NaturalCoordinate &position_in_natural_coordinates, | ||
const double depth, | ||
const unsigned int composition_number, | ||
WorldBuilder::grains grains, | ||
const double feature_min_depth, | ||
const double feature_max_depth) const override final; | ||
|
||
private: | ||
double min_depth; | ||
Objects::Surface min_depth_surface; | ||
double max_depth; | ||
Objects::Surface max_depth_surface; | ||
std::vector<unsigned int> grains; | ||
std::vector<unsigned int> compositions; | ||
std::string operation; | ||
std::vector<double> grain_sizes; | ||
std::vector<bool> normalize_grain_sizes; | ||
std::vector<double> deflections; | ||
}; | ||
} // namespace Grains | ||
} // namespace ContinentalPlateModels | ||
} // namespace Features | ||
} // namespace WorldBuilder | ||
|
||
#endif |
113 changes: 113 additions & 0 deletions
113
include/world_builder/features/fault_models/grains/random_uniform_distribution_deflected.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/* | ||
Copyright (C) 2018 - 2021 by the authors of the World Builder code. | ||
|
||
This file is part of the World Builder. | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published | ||
by the Free Software Foundation, either version 2 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Lesser General Public License for more details. | ||
|
||
You should have received a copy of the GNU Lesser General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef WORLD_BUILDER_FEATURES_FAULT_MODELS_GRAINS_RANDOM_UNIFORM_DISTRIBUTION_DEFLECTED_H | ||
#define WORLD_BUILDER_FEATURES_FAULT_MODELS_GRAINS_RANDOM_UNIFORM_DISTRIBUTION_DEFLECTED_H | ||
|
||
|
||
#include "world_builder/features/fault_models/grains/interface.h" | ||
|
||
namespace WorldBuilder | ||
{ | ||
|
||
namespace Features | ||
{ | ||
using namespace FeatureUtilities; | ||
namespace FaultModels | ||
{ | ||
namespace Grains | ||
{ | ||
/** | ||
* This class represents a fault and can implement | ||
* submodules for temperature and grains. These submodules determine | ||
* what the returned temperature or grains of the temperature and grains | ||
* functions of this class will be. | ||
*/ | ||
class RandomUniformDistributionDeflected final: public Interface | ||
{ | ||
public: | ||
/** | ||
* constructor | ||
*/ | ||
RandomUniformDistributionDeflected(WorldBuilder::World *world); | ||
|
||
/** | ||
* Destructor | ||
*/ | ||
~RandomUniformDistributionDeflected() override final; | ||
|
||
/** | ||
* declare and read in the world builder file into the parameters | ||
* class | ||
*/ | ||
static void declare_entries(Parameters &prm, | ||
const std::string &parent_name = ""); | ||
|
||
/** | ||
* declare and read in the world builder file into the parameters | ||
* class | ||
*/ | ||
static void declare_grain_size_model_entries( | ||
Parameters &prm, const std::string &parent_name, | ||
const std::vector<std::string> &required_entries); | ||
|
||
/** | ||
* declare and read in the world builder file into the parameters | ||
* class | ||
*/ | ||
static void | ||
declare_fixed_size_model_entries(Parameters &prm, | ||
const std::string &parent_name = ""); | ||
|
||
/** | ||
* declare and read in the world builder file into the parameters | ||
* class | ||
*/ | ||
void parse_entries(Parameters &prm) override final; | ||
|
||
/** | ||
* Returns a grains based on the given position, composition (e.g. | ||
* olivine and/or enstatite)depth in the model, gravity and current grains. | ||
*/ | ||
WorldBuilder::grains | ||
get_grains(const Point<3> &position, | ||
const double depth, | ||
const unsigned int composition_number, | ||
WorldBuilder::grains grains, | ||
const double feature_min_depth, | ||
const double feature_max_depth, | ||
const WorldBuilder::Utilities::PointDistanceFromCurvedPlanes &distance_from_planes, | ||
const AdditionalParameters &additional_parameters) const override final; | ||
|
||
private: | ||
double min_depth; | ||
double max_depth; | ||
std::vector<unsigned int> grains; | ||
std::vector<unsigned int> compositions; | ||
std::string operation; | ||
std::vector<double> grain_sizes; | ||
std::vector<bool> normalize_grain_sizes; | ||
std::vector<double> deflections; | ||
}; | ||
} // namespace Grains | ||
} // namespace FaultModels | ||
} // namespace Features | ||
} // namespace WorldBuilder | ||
|
||
#endif |
114 changes: 114 additions & 0 deletions
114
...world_builder/features/mantle_layer_models/grains/random_uniform_distribution_deflected.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
/* | ||
Copyright (C) 2018 - 2021 by the authors of the World Builder code. | ||
|
||
This file is part of the World Builder. | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published | ||
by the Free Software Foundation, either version 2 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Lesser General Public License for more details. | ||
|
||
You should have received a copy of the GNU Lesser General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef WORLD_BUILDER_FEATURES_MANTLE_LAYER_MODELS_GRAINS_RANDOM_UNIFORM_DISTRIBUTION_DEFLECTED_H | ||
#define WORLD_BUILDER_FEATURES_MANTLE_LAYER_MODELS_GRAINS_RANDOM_UNIFORM_DISTRIBUTION_DEFLECTED_H | ||
|
||
|
||
#include "world_builder/features/mantle_layer_models/grains/interface.h" | ||
#include "world_builder/objects/surface.h" | ||
|
||
namespace WorldBuilder | ||
{ | ||
|
||
namespace Features | ||
{ | ||
namespace MantleLayerModels | ||
{ | ||
namespace Grains | ||
{ | ||
/** | ||
* This class represents a mantle layer and can implement | ||
* submodules for temperature and grains. These submodules determine | ||
* what the returned temperature or grains of the temperature and grains | ||
* functions of this class will be. | ||
*/ | ||
class RandomUniformDistributionDeflected final: public Interface | ||
{ | ||
public: | ||
/** | ||
* constructor | ||
*/ | ||
RandomUniformDistributionDeflected(WorldBuilder::World *world); | ||
|
||
/** | ||
* Destructor | ||
*/ | ||
~RandomUniformDistributionDeflected() override final; | ||
|
||
/** | ||
* declare and read in the world builder file into the parameters | ||
* class | ||
*/ | ||
static void declare_entries(Parameters &prm, | ||
const std::string &parent_name = ""); | ||
|
||
/** | ||
* declare and read in the world builder file into the parameters | ||
* class | ||
*/ | ||
static void declare_grain_size_model_entries( | ||
Parameters &prm, const std::string &parent_name, | ||
const std::vector<std::string> &required_entries); | ||
|
||
/** | ||
* declare and read in the world builder file into the parameters | ||
* class | ||
*/ | ||
static void | ||
declare_fixed_size_model_entries(Parameters &prm, | ||
const std::string &parent_name = ""); | ||
|
||
/** | ||
* declare and read in the world builder file into the parameters | ||
* class | ||
*/ | ||
void parse_entries(Parameters &prm, const std::vector<Point<2>> &coordinates) override final; | ||
|
||
/** | ||
* Returns a grains based on the given position, composition (e.g. | ||
* olivine and/or enstatite)depth in the model, gravity and current grains. | ||
*/ | ||
WorldBuilder::grains | ||
get_grains(const Point<3> &position, | ||
const Objects::NaturalCoordinate &position_in_natural_coordinates, | ||
const double depth, | ||
const unsigned int composition_number, | ||
WorldBuilder::grains grains, | ||
const double feature_min_depth, | ||
const double feature_max_depth) const override final; | ||
|
||
private: | ||
double min_depth; | ||
Objects::Surface min_depth_surface; | ||
double max_depth; | ||
Objects::Surface max_depth_surface; | ||
std::vector<unsigned int> grains; | ||
std::vector<unsigned int> compositions; | ||
std::string operation; | ||
std::vector<double> grain_sizes; | ||
std::vector<bool> normalize_grain_sizes; | ||
std::vector<double> deflections; | ||
}; | ||
} // namespace Grains | ||
} // namespace MantleLayerModels | ||
} // namespace Features | ||
} // namespace WorldBuilder | ||
|
||
#endif |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.