Go to the documentation of this file.
33 template <
int spacedim,
class Value>
35 if (Value::NRows_ == Value::NCols_) {
45 template <
int spacedim,
class Value>
52 "Value of the constant field. "
53 "For vector values, you can use scalar value to enter constant vector. "
54 "For square (($N\\times N$))-matrix values, you can use: "
55 " - vector of size (($N$)) to enter diagonal matrix\n\n"
56 " - vector of size (($\\frac12N(N+1)$)) to enter symmetric matrix (upper triangle, row by row)\n"
57 " - scalar to enter multiple of the unit matrix." )
64 template <
int spacedim,
class Value>
66 Input::register_class< FieldConstant<spacedim, Value>,
unsigned int >(
"FieldConstant") +
70 template <
int spacedim,
class Value>
78 template <
int spacedim,
class Value>
87 template <
int spacedim,
class Value>
89 this->init_unit_conversion_coefficient(rec, init_data);
92 this->value_.scale(this->unit_conversion_coefficient_);
93 this->check_field_limits(rec, init_data);
95 typename Value::return_type tmp_value;
96 Value tmp_field_value(tmp_value);
97 tmp_field_value.set_n_comp(this->n_comp());
99 tmp_field_value.zeros();
100 if ( this->value_.equal_to(tmp_value) ) {
106 tmp_field_value.ones();
107 if ( this->value_.equal_to(tmp_value) ) {
114 tmp_field_value.eye();
115 if ( this->value_.equal_to(tmp_value) ) {
126 template <
int spacedim,
class Value>
133 for (
unsigned int i_cache = reg_chunk_begin; i_cache < reg_chunk_end; ++i_cache)
134 data_cache.
set(i_cache) = mat_value;
138 template <
int spacedim,
class Value>
141 if (Value::is_scalable())
142 for(
unsigned int row=0; row<this->value_.n_rows(); row++)
143 for(
unsigned int col=0; col<this->value_.n_cols(); col++) {
144 if ( (this->value_(row,col) < init_data.
limits_.first) || (this->value_(row,col) > init_data.
limits_.second) ) {
145 WarningOut().fmt(
"Value '{}' of Field '{}' at address '{}' is out of limits: <{}, {}>\nUnit of the Field: [{}]\n",
154 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
static Input::Type::Array get_tensor_input_type()
Implementation.
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()
#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