Flow123d
release_3.0.0-973-g92f55e826
|
Go to the documentation of this file.
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>
64 template <
int spacedim,
class Value>
73 template <
int spacedim,
class Value>
75 this->init_unit_conversion_coefficient(rec, init_data);
78 this->value_.init_from_input( rec.
val<
typename Value::AccessType>(
"value") );
79 this->value_.scale(this->unit_conversion_coefficient_);
80 this->check_field_limits(rec, init_data);
82 typename Value::return_type tmp_value;
83 Value tmp_field_value(tmp_value);
84 tmp_field_value.set_n_comp(this->n_comp());
86 tmp_field_value.zeros();
87 if ( this->value_.equal_to(tmp_value) ) {
93 tmp_field_value.ones();
94 if ( this->value_.equal_to(tmp_value) ) {
101 tmp_field_value.eye();
102 if ( this->value_.equal_to(tmp_value) ) {
116 template <
int spacedim,
class Value>
119 return this->r_value_;
127 template <
int spacedim,
class Value>
133 for(
unsigned int i=0; i< point_list.size(); i++) {
135 "value_list[%d] has wrong number of rows: %d; should match number of components: %d\n",
136 i,
Value(value_list[i]).n_rows(),this->value_.n_rows());
139 value_list[i]=this->r_value_;
144 template <
int spacedim,
class Value>
147 if (Value::is_scalable())
148 for(
unsigned int row=0; row<this->value_.n_rows(); row++)
149 for(
unsigned int col=0; col<this->value_.n_cols(); col++) {
150 if ( (this->value_(row,col) < init_data.
limits_.first) || (this->value_(row,col) > init_data.
limits_.second) ) {
151 WarningOut().fmt(
"Value '{}' of Field '{}' at address '{}' is out of limits: <{}, {}>\nUnit of the Field: [{}]\n",
160 template <
int spacedim,
class Value>
#define OLD_ASSERT_EQUAL(a, b)
std::string format_text() const
#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)
std::pair< double, double > limits_
Helper struct stores data for initizalize descentants of FieldAlgorithmBase.
FieldConstant(unsigned int n_comp=0)
static const Input::Type::Record & get_input_type()
Implementation.
#define WarningOut()
Macro defining 'warning' record of log.
#define INSTANCE_ALL(field)
virtual void value_list(const std::vector< Point > &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list)
void check_field_limits(const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data)
Compare field value with given minimal and maximal limits.
virtual const Value::return_type & value(const Point &p, const ElementAccessor< spacedim > &elm)
FieldConstant< spacedim, Value > & set_value(const typename Value::return_type &val)