Go to the documentation of this file.
32 template <
int spacedim,
class Value>
39 "Value of the constant field. "
40 "For vector values, you can use scalar value to enter constant vector. "
41 "For square (($N\\times N$))-matrix values, you can use: "
42 " - vector of size (($N$)) to enter diagonal matrix\n\n"
43 " - vector of size (($\\frac12N(N+1)$)) to enter symmetric matrix (upper triangle, row by row)\n"
44 " - scalar to enter multiple of the unit matrix." )
51 template <
int spacedim,
class Value>
53 Input::register_class< FieldConstant<spacedim, Value>,
unsigned int >(
"FieldConstant") +
57 template <
int spacedim,
class Value>
65 template <
int spacedim,
class Value>
74 template <
int spacedim,
class Value>
76 this->init_unit_conversion_coefficient(rec, init_data);
79 this->value_.init_from_input( rec.
val<
typename Value::AccessType>(
"value") );
80 this->value_.scale(this->unit_conversion_coefficient_);
81 this->check_field_limits(rec, init_data);
83 typename Value::return_type tmp_value;
84 Value tmp_field_value(tmp_value);
85 tmp_field_value.set_n_comp(this->n_comp());
87 tmp_field_value.zeros();
88 if ( this->value_.equal_to(tmp_value) ) {
94 tmp_field_value.ones();
95 if ( this->value_.equal_to(tmp_value) ) {
102 tmp_field_value.eye();
103 if ( this->value_.equal_to(tmp_value) ) {
114 template <
int spacedim,
class Value>
121 for (
unsigned int i_cache = reg_chunk_begin; i_cache < reg_chunk_end; ++i_cache)
122 data_cache.
set(i_cache) = mat_value;
126 template <
int spacedim,
class Value>
129 if (Value::is_scalable())
130 for(
unsigned int row=0; row<this->value_.n_rows(); row++)
131 for(
unsigned int col=0; col<this->value_.n_cols(); col++) {
132 if ( (this->value_(row,col) < init_data.
limits_.first) || (this->value_(row,col) > init_data.
limits_.second) ) {
133 WarningOut().fmt(
"Value '{}' of Field '{}' at address '{}' is out of limits: <{}, {}>\nUnit of the Field: [{}]\n",
142 template <
int spacedim,
class Value>
std::string format_text() const
void cache_update(FieldValueCache< typename Value::element_type > &data_cache, ElementCacheMap &cache_map, unsigned int region_patch_idx) override
Directing class of FieldValueCache.
#define FLOW123D_FORCE_LINK_IN_CHILD(x)
bool is_constant_in_space_
Flag detects that field is only dependent on time.
virtual void init_from_input(const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data) override
unsigned int region_chunk_end(unsigned int region_patch_idx) const
Return end position of region chunk in FieldValueCache.
std::pair< double, double > limits_
Helper struct stores data for initizalize descentants of FieldAlgorithmBase.
FieldConstant(unsigned int n_comp=0)
ArrayMatSet set(uint index)
unsigned int region_chunk_begin(unsigned int region_patch_idx) const
Return begin position of region chunk in FieldValueCache.
static const Input::Type::Record & get_input_type()
Implementation.
#define WarningOut()
Macro defining 'warning' record of log.
#define INSTANCE_ALL(field)
void check_field_limits(const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data)
Compare field value with given minimal and maximal limits.
FieldConstant< spacedim, Value > & set_value(const typename Value::return_type &val)
typename arma::Mat< Type >::template fixed< nr, nc > ArmaMat