1#ifndef included_AMP_Property
2 #define included_AMP_Property
4 #include "AMP/utils/ArraySize.h"
5 #include "AMP/utils/Database.h"
6 #include "AMP/utils/Units.h"
7 #include "AMP/utils/UtilityMacros.h"
15 #include <string_view>
60 std::string_view source =
"",
61 std::vector<std::string> args = {},
62 std::vector<std::array<double, 2>> ranges = {},
63 std::vector<Units> argUnits = {} );
119 "incorrect number of defaults specified" );
139 std::map<std::string, std::shared_ptr<AMP::LinearAlgebra::Vector>>
140 make_map(
const std::shared_ptr<AMP::LinearAlgebra::MultiVector> &args,
141 const std::map<std::string, std::string> &translator )
const;
158 bool throwError =
false )
const;
161 template<
class INPUT_VTYPE>
163 const INPUT_VTYPE &values,
165 bool throwError =
false )
const;
191 template<
class... Args>
205 const std::vector<std::string> &args,
206 const std::vector<double> &vec,
207 const std::vector<Units> &units = {} )
const;
219 template<
class... Args>
220 void evalv( std::vector<double> &r,
const Units &unit,
const Args &...args )
const;
230 template<
class... Args>
243 template<
class... Args>
244 void evalv( std::vector<std::shared_ptr<std::vector<double>>> &r,
246 const Args &...args )
const;
256 template<
class... Args>
257 void evalv( std::vector<std::shared_ptr<AMP::LinearAlgebra::Vector>> &r,
258 const Args &...args )
const;
267 template<
class... Args>
270 const Args &...args )
const;
280 template<
class... Args>
282 const Args &...args )
const;
294 template<
class... Args>
306 template<
class... Args>
337 void evalArgs(
AMP::Array<double>&,
const std::shared_ptr<AMP::LinearAlgebra::MultiVector>&,
const std::map<std::string, std::string>& = {} )
const;
340 template<
class... Args>
342 template<
class... Args>
344 template<
class... Args>
346 template<
class... Args>
348 template<
class... Args>
350 template<
class... Args>
352 template<
class VEC,
class... Args>
354 template<
class VEC,
class... Args>
356 void evalArgs(
AMP::Array<double>&,
const std::vector<double> &args,
const std::vector<std::string> &names,
const std::vector<Units> &argUnits = {} )
const;
402#include "AMP/materials/Property.hpp"
Simple class to store the array dimensions.
constexpr uint8_t ndim() const
Return the number of dimensions.
constexpr size_t length() const
Return the total number of elements in the array.
Abstraction of a discrete Vector in a linear simulation.
Provides material properties of scalar type.
bool is_argument(std::string_view argname) const
Determine if a string is an argument.
void set_default(std::string_view name, double value, const AMP::Units &unit=AMP::Units())
Set the default.
bool isScalar() const
Indicator for scalar evaluator.
std::map< std::string, std::shared_ptr< AMP::LinearAlgebra::Vector > > make_map(const std::shared_ptr< AMP::LinearAlgebra::MultiVector > &args, const std::map< std::string, std::string > &translator) const
AMP::Database d_auxiliaryData
Database containing auxiliary data.
void evalv(const AMP::Array< double > &, AMP::Array< std::vector< double > * > &, const Units &) const
const std::string & get_source() const
Get the source of the information.
void evalv(AMP::Array< std::shared_ptr< AMP::LinearAlgebra::Vector > > &r, const Args &...args) const
Evaluate the property.
void evalArgs(AMP::Array< double > &, const std::vector< double > &args, const std::vector< std::string > &names, const std::vector< Units > &argUnits={}) const
const auto & get_arg_ranges() const
Get ranges for all arguments used in this material.
std::vector< std::array< double, 2 > > d_ranges
allowed ranges of arguments
void evalv(std::vector< std::shared_ptr< AMP::LinearAlgebra::Vector > > &r, const Args &...args) const
Evaluate the property.
Property(std::string_view name, const ArraySize &size={ 1 }, const Units &unit=Units(), std::string_view source="", std::vector< std::string > args={}, std::vector< std::array< double, 2 > > ranges={}, std::vector< Units > argUnits={})
void evalArg(AMP::Array< double > &, std::string_view, const Units &, double) const
void evalv(AMP::Array< std::vector< double > * > &r, const Units &unit, const Args &...args) const
Evaluate the property.
const std::vector< std::string > & get_arguments() const
Return the names of the arguments to eval.
void evalv(AMP::Array< std::shared_ptr< std::vector< double > > > &r, const Units &unit, const Args &...args) const
Evaluate the property.
const std::string & get_name() const
Return name of property.
bool isTensor() const
Indicator for tensor evaluator.
void setAuxiliaryData(const std::string &key, const TYPE &data)
Set auxiliary data.
double eval(const Units &unit, const std::vector< std::string > &args, const std::vector< double > &vec, const std::vector< Units > &units={}) const
Evaluate the property.
void evalArgs(AMP::Array< double > &, std::string_view, const std::shared_ptr< VEC > &, const Args &...) const
void evalArgs(AMP::Array< double > &, std::string_view, const Units &, const std::vector< double > &, const Args &...) const
AMP::Units d_units
default units to return
const ArraySize & size() const
get dimensions of evalv return value
std::map< std::string_view, size_t > d_argToIndexMap
map argument names to indices
void evalArg(AMP::Array< double > &, std::string_view, const Units &, const std::vector< double > &) const
AMP::ArraySize d_dim
size of the result
void evalv(AMP::Array< AMP::LinearAlgebra::Vector * > &r, const Args &...args) const
Evaluate the property.
void evalArgs(AMP::Array< double > &, std::string_view, const std::vector< double > &, const Args &...) const
virtual std::string evalString() const
Get the string value of the property.
void evalArg(AMP::Array< double > &, std::string_view, const Units &, const AMP::LinearAlgebra::Vector &) const
std::vector< Units > d_argUnits
default units for the arguments
void evalv(std::vector< std::shared_ptr< std::vector< double > > > &r, const Units &unit, const Args &...args) const
Evaluate the property.
int get_arg_index(std::string_view name) const
void evalArgs(AMP::Array< double > &, std::string_view, const Units &, const AMP::LinearAlgebra::Vector &, const Args &...) const
void evalv(AMP::LinearAlgebra::Vector &r, const Args &...args) const
Evaluate the property.
static size_t getSize(const AMP::LinearAlgebra::Vector &)
AMP::Array< double > defaultArgs(size_t) const
Create the default argument array.
const std::vector< double > & get_defaults() const
Get the defaults.
bool in_range(std::string_view argname, const INPUT_VTYPE &values, const Units &unit=Units(), bool throwError=false) const
Determine if a set of values are all within range or not.
std::vector< std::string > d_arguments
names of the arguments
void evalArgs(AMP::Array< double > &) const
void evalArgs(AMP::Array< double > &, std::string_view, const AMP::LinearAlgebra::Vector &, const Args &...) const
double get_default(std::string_view name) const
Get the default for the given argument (NaN if it is an invalid argument)
int get_argument_index(std::string_view name) const
Return the argument index.
void evalArgs(AMP::Array< double > &, std::string_view, const Units &, const std::shared_ptr< VEC > &, const Args &...) const
bool in_range(std::string_view argname, double value, const Units &unit=Units(), bool throwError=false) const
Determine if a value is within range or not.
TYPE getAuxiliaryData(const std::string &key) const
Get auxiliary data.
void checkArgs(const AMP::Array< double > &args) const
Check the argument values.
const Units & get_units() const
Return source reference.
void evalArgs(AMP::Array< double > &, std::string_view, double, const Args &...) const
std::array< double, 2 > get_arg_range(std::string_view argname) const
Get range for a specific argument.
std::string d_name
should be unique
const Database & getAuxiliaryData() const
Get auxiliary data.
bool isVector() const
Indicator for vector evaluator.
std::string d_source
reference for source data
const auto & get_arg_units() const
Get units for all arguments used in this material.
void evalArgs(AMP::Array< double > &, const std::map< std::string, VEC > &) const
void evalv(const AMP::Array< double > &, AMP::Array< AMP::LinearAlgebra::Vector * > &) const
void evalv(std::vector< double > &r, const Units &unit, const Args &...args) const
Evaluate the property.
std::vector< double > d_defaults
default values of arguments
void set_defaults(std::vector< double > defaults)
Set the defaults.
void evalArgs(AMP::Array< double > &, std::string_view, const Units &, double, const Args &...) const
static Units getUnits(const AMP::LinearAlgebra::Vector &)
double eval(const Units &unit=Units(), const Args &...args) const
Evaluate the property.
virtual void eval(AMP::Array< double > &result, const AMP::Array< double > &args) const =0
void evalArgs(AMP::Array< double > &, const std::shared_ptr< AMP::LinearAlgebra::MultiVector > &, const std::map< std::string, std::string > &={}) const
virtual ~Property()
Destructor.
size_t get_number_arguments() const
Return the number of arguments to eval.
virtual bool isString() const
Indicator for scalar evaluator.
Provides a class for storing units.
constexpr bool isNull() const
Check if unit is null.
constexpr double convert(const Units &unit) const
Convert the unit to a new type.
#define AMP_INSIST(EXP, MSG)
Insist error.
std::unique_ptr< Property > createProperty(std::string_view key, const Database &db)
Create a property from a database data.