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>
79 this->
value_.init_from_input( rec.
val<
typename Value::AccessType>(
"value") );
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>
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());
146 template <
int spacedim,
class Value>
152 unsigned int i_cache_el_begin = update_cache_data.region_value_cache_range_[region_in_cache];
153 unsigned int i_cache_el_end = update_cache_data.region_value_cache_range_[region_in_cache+1];
155 for (
unsigned int i_cache = i_cache_el_begin; i_cache < i_cache_el_end; ++i_cache)
156 data_cache.
data().
set(i_cache) = mat_value;
160 template <
int spacedim,
class Value>
163 if (Value::is_scalable())
164 for(
unsigned int row=0; row<this->
value_.n_rows(); row++)
165 for(
unsigned int col=0; col<this->
value_.n_cols(); col++) {
167 WarningOut().fmt(
"Value '{}' of Field '{}' at address '{}' is out of limits: <{}, {}>\nUnit of the Field: [{}]\n",
176 template <
int spacedim,
class Value>
void init_unit_conversion_coefficient(const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data)
Init value of unit_conversion_coefficient_ from input.
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)
unsigned int size() const
virtual void value_list(const Armor::array &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list) override
std::string format_text() const
const UpdateCacheHelper & update_cache_data() const
Return update cache data helper.
FieldResult field_result_
Indicator of particular values (zero, one) constant over space.
void cache_update(FieldValueCache< typename Value::element_type > &data_cache, ElementCacheMap &cache_map, unsigned int region_idx) override
#define INSTANCE_ALL(field)
Directing class of FieldValueCache.
Helper struct stores data for initizalize descentants of FieldAlgorithmBase.
Value::return_type r_value_
virtual Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm) override
double unit_conversion_coefficient_
Coeficient of conversion of user-defined unit.
const Armor::Array< elm_type > & data() const
Return data vector.
std::unordered_map< unsigned int, unsigned int > region_cache_indices_range_
FieldConstant(unsigned int n_comp=0)
virtual void init_from_input(const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data) override
ArrayMatSet set(uint index)
Space< spacedim >::Point Point
typename arma::Mat< Type >::template fixed< nr, nc > ArmaMat
bool is_constant_in_space_
Flag detects that field is only dependent on time.
Value value_
Last value, prevents passing large values (vectors) by value.
#define WarningOut()
Macro defining 'warning' record of log.
#define OLD_ASSERT_EQUAL(a, b)
std::pair< double, double > limits_
#define FLOW123D_FORCE_LINK_IN_CHILD(x)
unsigned int n_comp() const