https://gitlab.opengeosys.org/ogs/ogs.git
Raw File
Tip revision: 734261b3ee2ff9a172b90739f1cf7e2ae9823c25 authored by rinkk on 11 February 2021, 14:52:44 UTC
[utils] added voting mechanic to bridge small discontinuities such as horizon-shifts due to faults, adjusted test to reflect this change
Tip revision: 734261b
TimeDependentHeterogeneousParameter.h
/**
 * \file
 * \copyright
 * Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org)
 *            Distributed under a Modified BSD License.
 *              See accompanying file LICENSE.txt or
 *              http://www.opengeosys.org/project/license
 *
 */

#pragma once

#include <algorithm>

#include "Parameter.h"

/// The TimeDependentHeterogeneousParameter class implements a parameter that
/// varies in time and space, i.e., it is a function \f$ (t, x) \mapsto f(t, x)
/// \in T^n \f$.
namespace ParameterLib
{
class TimeDependentHeterogeneousParameter final : public Parameter<double>
{
public:
    using PairTimeParameterName = std::pair<double, std::string>;
    using PairTimeParameter = std::pair<double, Parameter<double> const* const>;

    TimeDependentHeterogeneousParameter(std::string name,
                                        std::vector<PairTimeParameterName>
                                            time_parameter_name_mapping);

    /// @copydoc Parameter::getNumberOfGlobalComponents()
    int getNumberOfGlobalComponents() const override;

    bool isTimeDependent() const override;

    /// @copydoc Parameter::operator()()
    std::vector<double> operator()(double const t,
                                   SpatialPosition const& pos) const override;

    /// The TimeDependentHeterogeneousParameter depends in each time step on a
    /// parameter. Since, at construction time of the
    /// TimeDependentHeterogeneousParameter other parameter needs not to be
    /// constructed and hence can't be used to setup the object this is done
    /// later on in the initialize method.
    void initialize(
        std::vector<std::unique_ptr<ParameterBase>> const& parameters) override;

private:
    std::vector<PairTimeParameterName> _time_parameter_name_mapping;
    std::vector<PairTimeParameter> _time_parameter_mapping;
};

std::unique_ptr<ParameterBase> createTimeDependentHeterogeneousParameter(
    std::string const& name, BaseLib::ConfigTree const& config);
}  // namespace ParameterLib
back to top