Go to the documentation of this file.
18 #ifndef field_algo_base_IMPL_HH_
19 #define field_algo_base_IMPL_HH_
46 template <
int spacedim,
class Value>
51 unit_conversion_coefficient_(1.0)
58 template <
int spacedim,
class Value>
60 return fmt::format(
"R{:d}_to_{}", spacedim, Value::type_name() );
65 template <
int spacedim,
class Value>
68 ss <<
"[" << Value::NRows_ <<
", " << Value::NCols_ <<
"]";
69 return it::Abstract(
"Field_"+template_name(),
"Abstract for all time-space functions.")
77 template <
int spacedim,
class Value>
82 param_vec.push_back( std::make_pair(
"element_input_type", std::make_shared<it::Selection>(value_selection)) );
84 param_vec.push_back( std::make_pair(
"element_input_type", std::make_shared<typename Value::ElementInputType>()) );
90 template <
int spacedim,
class Value>
92 return it::Record(
"FieldAlgorithmBase_common_aux",
"")
94 "Unit of the field values provided in the main input file, in the external file, or "
95 "by a function (FieldPython).")
99 template <
int spacedim,
class Value>
100 shared_ptr< FieldAlgorithmBase<spacedim, Value> >
103 shared_ptr< FieldAlgorithmBase<spacedim, Value> > func;
111 template <
int spacedim,
class Value>
113 THROW( ExcInputInitUnsupported() << EI_Field(
typeid(
this).name()) );
118 template <
int spacedim,
class Value>
126 template <
int spacedim,
class Value>
132 template<
int spacedim,
class Value>
134 return (Value::NRows_ ? 0 : value_.n_rows());
138 template<
int spacedim,
class Value>
148 template<
int spacedim,
class Value>
153 template<
int spacedim,
class Value>
158 if ( rec.
opt_val(
"unit", unit_record) ) {
159 if (!Value::is_scalable()) {
160 WarningOut().fmt(
"Setting unit conversion coefficient of non-floating point field at address {}\nCoefficient will be skipped.\n",
163 std::string unit_str = unit_record.
val<std::string>(
"unit_formula");
166 }
catch (ExcInvalidUnit &e) {
169 }
catch (ExcNoncorrespondingUnit &e) {
179 #endif //FUNCTION_BASE_IMPL_HH_
unsigned int n_comp() const
Basic time management class.
static const Input::Type::Record & get_field_algo_common_keys()
Directing class of FieldValueCache.
virtual void cache_reinit(const ElementCacheMap &cache_map)
Allows reinit data members or structures in descendants during reinit of FieldValueCache of 'parental...
static const Input::Type::Instance & get_input_type_instance(Input::Type::Selection value_selection=Input::Type::Selection())
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
double convert_unit_from(std::string actual_unit) const
Convert and check user-defined unit.
static Input::Type::Abstract & get_input_type()
std::string format(CStringRef format_str, ArgList args)
static string field_value_shape()
FieldAlgorithmBase(unsigned int n_comp=0)
virtual void cache_update(FieldValueCache< typename Value::element_type > &data_cache, ElementCacheMap &cache_map, unsigned int region_patch_idx)
#define ASSERT_PERMANENT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
const unsigned int undef_idx
Helper struct stores data for initizalize descentants of FieldAlgorithmBase.
virtual void init_from_input(const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data)
Representation of one time step..
Value value_
Last value, prevents passing large values (vectors) by value.
void init_unit_conversion_coefficient(const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data)
Init value of unit_conversion_coefficient_ from input.
virtual void set_mesh(const Mesh *mesh, bool boundary_domain)
static const Input::Type::Record & get_input_type()
static std::string template_name()
#define WarningOut()
Macro defining 'warning' record of log.
virtual bool set_time(const TimeStep &time)
static std::shared_ptr< FieldAlgorithmBase< spacedim, Value > > function_factory(const Input::AbstractRecord &rec, const struct FieldAlgoBaseInitData &init_data)