Flow123d
JS_before_hm-2154-g185f171e0
|
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>
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_ <<
"]";
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>
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++) {
162 ASSERT(
Value(value_list[i]).n_rows()==this->value_.n_rows() )(i)(
Value(value_list[i]).n_rows())(this->value_.n_rows())
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_
unsigned int n_comp() const
Basic time management class.
#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
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())
ArmaVec< Type, nr > vec(uint mat_index) const
static constexpr bool value
#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)
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.
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual)
virtual void set_mesh(const Mesh *mesh, bool boundary_domain)
static const Input::Type::Record & get_input_type()
unsigned int size() const
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)