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>
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++) {
165 WarningOut().fmt(
"Value '{}' of Field '{}' at address '{}' is out of limits: <{}, {}>\nUnit of the Field: [{}]\n",
174 template <
int spacedim,
class Value>
unsigned int region_chunk_begin(unsigned int region_patch_idx) const
Return begin position of region chunk in FieldValueCache.
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
FieldResult field_result_
Indicator of particular values (zero, one) constant over space.
#define INSTANCE_ALL(field)
Directing class of FieldValueCache.
Helper struct stores data for initizalize descentants of FieldAlgorithmBase.
Value::return_type r_value_
void cache_update(FieldValueCache< typename Value::element_type > &data_cache, ElementCacheMap &cache_map, unsigned int region_patch_idx) override
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.
FieldConstant(unsigned int n_comp=0)
unsigned int region_chunk_end(unsigned int region_patch_idx) const
Return end position of region chunk in FieldValueCache.
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