31 template <
int spacedim, class Value>
38 "Value of the constant field. " 39 "For vector values, you can use scalar value to enter constant vector. " 40 "For square (($N\\times N$))-matrix values, you can use: " 41 " - vector of size (($N$)) to enter diagonal matrix\n\n" 42 " - vector of size (($\\frac12N(N+1)$)) to enter symmetric matrix (upper triangle, row by row)\n" 43 " - scalar to enter multiple of the unit matrix." )
50 template <
int spacedim,
class Value>
52 Input::register_class< FieldConstant<spacedim, Value>,
unsigned int >(
"FieldConstant") +
56 template <
int spacedim,
class Value>
62 template <
int spacedim,
class Value>
71 template <
int spacedim,
class Value>
76 this->
value_.init_from_input( rec.
val<
typename Value::AccessType>(
"value") );
80 typename Value::return_type tmp_value;
81 Value tmp_field_value(tmp_value);
82 tmp_field_value.set_n_comp(this->
n_comp());
84 tmp_field_value.zeros();
85 if ( this->
value_.equal_to(tmp_value) ) {
91 tmp_field_value.ones();
92 if ( this->
value_.equal_to(tmp_value) ) {
99 tmp_field_value.eye();
100 if ( this->
value_.equal_to(tmp_value) ) {
114 template <
int spacedim,
class Value>
125 template <
int spacedim,
class Value>
131 for(
unsigned int i=0; i< point_list.size(); i++) {
133 "value_list[%d] has wrong number of rows: %d; should match number of components: %d\n",
134 i, Value(value_list[i]).n_rows(),this->
value_.n_rows());
142 template <
int spacedim,
class Value>
145 if (Value::is_scalable())
146 for(
unsigned int row=0; row<this->
value_.n_rows(); row++)
147 for(
unsigned int col=0; col<this->
value_.n_cols(); col++) {
149 WarningOut().fmt(
"Value '{}' of Field '{}' at address '{}' is out of limits: <{}, {}>\nUnit of the Field: [{}]\n",
158 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)
std::string format_text() const
FieldResult field_result_
Indicator of particular values (zero, one) constant over space.
virtual void value_list(const std::vector< Point > &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list)
#define INSTANCE_ALL(field)
Helper struct stores data for initizalize descentants of FieldAlgorithmBase.
virtual Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm)
Value::return_type r_value_
double unit_conversion_coefficient_
Coeficient of conversion of user-defined unit.
FieldConstant(unsigned int n_comp=0)
virtual void init_from_input(const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data)
Space< spacedim >::Point Point
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