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

Add random_uniform_distribution_deflected to all features and enable random number seed as input #584

Merged
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
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
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
Copy link
Contributor

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?

Copy link
Contributor Author

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.

* 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
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
Loading
Loading