Flow123d
JS_before_hm-2198-g122e1f2e2
|
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) ) {
117 template <
int spacedim,
class Value>
120 return this->r_value_;
128 template <
int spacedim,
class Value>
135 for(
unsigned int i=0; i< point_list.
size(); i++) {
137 "value_list[%d] has wrong number of rows: %d; should match number of components: %d\n",
138 i,
Value(value_list[i]).n_rows(),this->value_.n_rows());
141 value_list[i]=this->r_value_;
146 template <
int spacedim,
class Value>
153 for (
unsigned int i_cache = reg_chunk_begin; i_cache < reg_chunk_end; ++i_cache)
154 data_cache.
set(i_cache) = mat_value;
158 template <
int spacedim,
class Value>
161 if (Value::is_scalable())
162 for(
unsigned int row=0; row<this->value_.n_rows(); row++)
163 for(
unsigned int col=0; col<this->value_.n_cols(); col++) {
164 if ( (this->value_(row,col) < init_data.
limits_.first) || (this->value_(row,col) > init_data.
limits_.second) ) {
165 WarningOut().fmt(
"Value '{}' of Field '{}' at address '{}' is out of limits: <{}, {}>\nUnit of the Field: [{}]\n",
174 template <
int spacedim,
class Value>
#define OLD_ASSERT_EQUAL(a, b)
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.
Space< spacedim >::Point Point
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)
virtual void value_list(const Armor::array &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list) override
ArrayMatSet set(uint index)
unsigned int size() const
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
virtual const Value::return_type & value(const Point &p, const ElementAccessor< spacedim > &elm) override