18 #ifndef field_algo_base_IMPL_HH_ 19 #define field_algo_base_IMPL_HH_ 46 template <
int spacedim,
class Value>
50 component_idx_(
std::numeric_limits<unsigned int>::max()),
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_ <<
"]";
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>
144 ASSERT_DBG(
false).error(
"Must be implemented in descendants!\n");
148 template<
int spacedim,
class Value>
153 template<
int spacedim,
class Value>
161 for(
unsigned int i=0; i< point_list.
size(); i++) {
163 .error(
"value_list has wrong number of rows");
164 value_list[i]=this->
value(point_list.
vec<spacedim>(i), elm);
169 template<
int spacedim,
class Value>
174 if ( rec.
opt_val(
"unit", unit_record) ) {
175 if (!Value::is_scalable()) {
176 WarningOut().fmt(
"Setting unit conversion coefficient of non-floating point field at address {}\nCoefficient will be skipped.\n",
179 std::string unit_str = unit_record.
val<std::string>(
"unit_formula");
182 }
catch (ExcInvalidUnit &e) {
185 }
catch (ExcNoncorrespondingUnit &e) {
195 #endif //FUNCTION_BASE_IMPL_HH_
TimeStep time_
Actual time level; initial value is -infinity.
void init_unit_conversion_coefficient(const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data)
Init value of unit_conversion_coefficient_ from input.
unsigned int size() const
virtual void cache_update(FieldValueCache< typename Value::element_type > &data_cache, ElementCacheMap &cache_map, unsigned int region_patch_idx)
static const Input::Type::Instance & get_input_type_instance(Input::Type::Selection value_selection=Input::Type::Selection())
virtual bool set_time(const TimeStep &time)
double convert_unit_from(std::string actual_unit) const
Convert and check user-defined unit.
std::string format(CStringRef format_str, ArgList args)
Directing class of FieldValueCache.
Helper struct stores data for initizalize descentants of FieldAlgorithmBase.
static const Input::Type::Record & get_input_type()
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
virtual void value_list(const Armor::array &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list)=0
ArmaVec< Type, nr > vec(uint mat_index) const
virtual Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm)=0
Basic time management class.
static constexpr bool is_enum_valued
double unit_conversion_coefficient_
Coeficient of conversion of user-defined unit.
virtual void init_from_input(const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data)
static string field_value_shape()
static std::shared_ptr< FieldAlgorithmBase< spacedim, Value > > function_factory(const Input::AbstractRecord &rec, const struct FieldAlgoBaseInitData &init_data)
FieldAlgorithmBase(unsigned int n_comp=0)
Value value_
Last value, prevents passing large values (vectors) by value.
static Input::Type::Abstract & get_input_type()
virtual void set_mesh(const Mesh *mesh, bool boundary_domain)
#define WarningOut()
Macro defining 'warning' record of log.
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::Record & get_field_algo_common_keys()
static std::string template_name()
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
Representation of one time step..
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual)
unsigned int n_comp() const