Flow123d  release_2.2.0-914-gf1a3a4f
field_values.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file field_values.hh
15  * @brief
16  */
17 
18 #ifndef FIELD_VALUES_HH_
19 #define FIELD_VALUES_HH_
20 
21 #include <cmath>
22 #include <cstdlib>
23 
24 #include <armadillo>
25 #include <boost/format.hpp>
26 #include <system/exceptions.hh>
27 #include "input/input_type.hh"
28 #include "input/accessors.hh"
29 #include <ostream>
30 
31 namespace IT=Input::Type;
32 
33 /**
34  * @file
35  *
36  * This file contains various dispatch classes to simplify implementation of Fields. Essential is class template
37  * @p FieldValues_ which provides unified access and initialization to scalar, vector and matrix type object in Armadillo library
38  */
39 
40 TYPEDEF_ERR_INFO( EI_InputMsg, const string );
41 DECLARE_INPUT_EXCEPTION( ExcFV_Input, << "Wrong field value input: " << EI_InputMsg::val );
42 
43 typedef unsigned int FieldEnum;
44 
45 
46 
47 namespace internal {
48 
49 // Helper functions to get scalar type name
50 /*
51 std::string type_name_(double);
52 std::string type_name_(int);
53 std::string type_name_(FieldEnum);
54 */
55 
56 /**
57  * InputType dispatch from elementary type @p ET of FieldValues_ to elementary Input::Type, i.e. descendant of Input::Type::Scalar.
58  */
59 template <class ET>
60 struct InputType { typedef Input::Type::Double type; };
61 
62 template <>
63 struct InputType<int> { typedef Input::Type::Integer type; };
64 
65 template <>
67 
68 
69 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
70 // resolution of Value::return_type
71 
72 // general element type
73 template<int NRows, int NCols, class ET>
74 struct ReturnType { typedef typename arma::Mat<ET>::template fixed<NRows, NCols> return_type; };
75 
76 template<class ET>
77 struct ReturnType<1,1,ET> { typedef ET return_type; };
78 
79 template <class ET>
80 struct ReturnType<0,1,ET> { typedef arma::Col<ET> return_type; };
81 
82 template <int NRows, class ET>
83 struct ReturnType<NRows,1,ET> { typedef typename arma::Col<ET>::template fixed<NRows> return_type; };
84 
85 
86 // FiledEnum element type - this just returns types with ET=unsigned int, however input should be different
87 template<int NRows, int NCols>
88 struct ReturnType<NRows, NCols, FieldEnum> { typedef typename arma::Mat<unsigned int>::template fixed<NRows, NCols> return_type; };
89 
90 template<>
91 struct ReturnType<1,1, FieldEnum> { typedef unsigned int return_type; };
92 
93 template <>
94 struct ReturnType<0,1, FieldEnum> { typedef arma::Col<unsigned int> return_type; };
95 
96 template <int NRows>
97 struct ReturnType<NRows,1, FieldEnum> { typedef typename arma::Col<unsigned int>::template fixed<NRows> return_type; };
98 
99 
100 // Resolution of helper functions for raw constructor
101 template <class RT> inline RT & set_raw_scalar(RT &val, double *raw_data) { return *raw_data;}
102 template <class RT> inline RT & set_raw_scalar(RT &val, int *raw_data) { return *raw_data;}
103 template <class RT> inline RT & set_raw_scalar(RT &val, FieldEnum *raw_data) { return *raw_data;}
104 
105 template <class RT> inline RT & set_raw_vec(RT &val, double *raw_data) { arma::access::rw(val.mem) = raw_data; return val;}
106 template <class RT> inline RT & set_raw_vec(RT &val, int *raw_data) { arma::access::rw(val.mem) = raw_data; return val;}
107 template <class RT> inline RT & set_raw_vec(RT &val, FieldEnum *raw_data) { arma::access::rw(val.mem) = raw_data; return val;}
108 
109 template <class RT> inline RT & set_raw_fix(RT &val, double *raw_data) { val = RT(raw_data); return val;}
110 template <class RT> inline RT & set_raw_fix(RT &val, int *raw_data) { val = RT(raw_data); return val;}
111 template <class RT> inline RT & set_raw_fix(RT &val, FieldEnum *raw_data) { val = RT(raw_data); return val;}
112 
113 
114 
115 // Resolution of input accessor for vector values of enums,
116 template <class ET>
117 struct AccessTypeDispatch { typedef ET type;};
118 template <>
119 struct AccessTypeDispatch<unsigned int> { typedef Input::Enum type; };
120 
121 
122 
123 
124 /**
125  * Initialize an Armadillo matrix from the input.
126  * Since only limited methods are used we can use this template to initialize StringTensor as well.
127  * Used methodas are: at(row,col), zeros()
128  */
129 template<class MatrixType>
130 void init_matrix_from_input( MatrixType &value, Input::Array rec ) {
131  typedef typename MatrixType::elem_type ET;
132  unsigned int nrows = value.n_rows;
133  unsigned int ncols = value.n_cols;
134 
136  if (it->size() == 1 && nrows == ncols) {
137  // square tensor
138  // input = 3 expands to [ [ 3 ] ]; init to 3 * (identity matrix)
139  // input = [1, 2, 3] expands to [[1], [2], [3]]; init to diag. matrix
140  // input = [1, 2, 3, .. , (N+1)*N/2], .... ; init to symmetric matrix [ [1 ,2 ,3], [2, 4, 5], [ 3, 5, 6] ]
141  if (rec.size() == 1) {// scalar times identity
142  value.zeros();
143  ET scalar=*(it->begin<ET>());
144  for(unsigned int i=0; i< nrows; i++) value.at(i,i)=scalar;
145  } else if (rec.size() == nrows) { // diagonal vector
146  value.zeros();
147  for(unsigned int i=0; i< nrows; i++, ++it) value.at(i,i)=*(it->begin<ET>());
148  } else if (rec.size() == (nrows+1)*nrows/2) { // symmetric part
149  for( unsigned int row=0; row<nrows; row++)
150  for( unsigned int col=0; col<ncols; col++)
151  if (row <= col) {
152  value.at(row,col) = *(it->begin<ET>());
153  ++it;
154  } else value.at(row,col) = value.at(col,row);
155  } else {
156  THROW( ExcFV_Input()
157  << EI_InputMsg(
158  boost::str(boost::format("Initializing symmetric matrix %dx%d by vector of wrong size %d, should be 1, %d, or %d.")
159  % nrows % ncols % rec.size() % nrows % ((nrows+1)*nrows/2)))
160  << rec.ei_address()
161 
162  );
163  }
164 
165  } else {
166  // accept only full tensor
167  if (rec.size() == nrows && it->size() == ncols) {
168 
169  for (unsigned int row = 0; row < nrows; row++, ++it) {
170  if (it->size() != ncols)
171  THROW( ExcFV_Input() << EI_InputMsg("Wrong number of columns.")
172  << rec.ei_address());
173  Input::Iterator<ET> col_it = it->begin<ET>();
174  for (unsigned int col = 0; col < ncols; col++, ++col_it)
175  value.at(row, col) = *col_it;
176  }
177  } else {
178  THROW( ExcFV_Input()
179  << EI_InputMsg(
180  boost::str(boost::format("Initializing matrix %dx%d by matrix of wrong size %dx%d.")
181  % nrows % ncols % rec.size() % it->size() ))
182  << rec.ei_address()
183  );
184  }
185  }
186 }
187 
188 /**
189  * Initialize an Armadillo vector from the input.
190  * Since only limited methods are used we can use this template to initialize StringTensor as well.
191  * Used methodas are: at(row,col), zeros()
192  */
193 template<class VectorType>
194 void init_vector_from_input( VectorType &value, Input::Array rec ) {
195  typedef typename VectorType::elem_type ET;
196  unsigned int nrows = value.n_rows;
197 
198  typedef typename AccessTypeDispatch<ET>::type InnerType;
199  Input::Iterator<InnerType> it = rec.begin<InnerType>();
200 
201  if ( rec.size() == 1 ) {
202  for(unsigned int i=0; i< nrows; i++)
203  value.at(i)=ET(*it);
204  } else if ( rec.size() == nrows ) {
205  for(unsigned int i=0; i< nrows; i++, ++it) {
206  value.at(i)=ET(*it);
207  }
208  } else {
209  THROW( ExcFV_Input()
210  << EI_InputMsg(
211  boost::str(boost::format("Initializing vector of size %d by vector of size %d.")
212  % nrows % rec.size() ))
213  << rec.ei_address()
214  );
215  }
216 }
217 
218 
219 
220 } // namespace internal
221 
222 
223 
224 /**
225  * Template for class representing all possible Filed values. It is just common interface to
226  * scalar (double, int) values, vector and tensor values with fixed size and vector/tensor values with variable size.
227  *
228  * ET is type of elements, n_cols and n_rows gives fixed dimensions of the tensor value (nx1 is vector, 1x1 is scalar,
229  * 0x1 is variable size vector, 0x0 is variable size tensor (not implemented yet) )
230  *
231  *
232  */
233 template <int NRows, int NCols, class ET>
234 class FieldValue_ {
235 public:
236  typedef ET element_type;
240  const static int NRows_ = NRows;
241  const static int NCols_ = NCols;
242  const static int rank_ = 2;
243 
244  static std::string type_name() { return boost::str(boost::format("R[%d,%d]") % NRows % NCols); }
246  if (NRows == NCols) {
247  // for square tensors allow initialization by diagonal vector, etc.
248  return IT::Array( IT::Array( IT::Parameter("element_input_type"), 1), 1 );
249  }
250  else {
251  return IT::Array( IT::Array( IT::Parameter("element_input_type"), NCols, NCols), NRows, NRows );
252  }
253 
254  }
255  static constexpr bool is_scalable() {
257  }
258 
259 
260  inline FieldValue_(return_type &val) : value_(val) {}
261  inline static const return_type &from_raw(return_type &val, ET *raw_data) {return internal::set_raw_fix(val, raw_data);}
262  const ET * mem_ptr() const {
263  return value_.memptr();
264  }
265 
266  void init_from_input( AccessType rec ) {
268  }
269 
270  void set_n_comp(unsigned int) {};
271  inline unsigned int n_cols() const
272  { return NCols; }
273  inline unsigned int n_rows() const
274  { return NRows; }
275  inline ET &operator() ( unsigned int i, unsigned int j)
276  { return value_.at(i,j); }
277  inline ET operator() ( unsigned int i, unsigned int j) const
278  { return value_.at(i,j); }
279  inline operator return_type() const
280  { return value_;}
281 
282  // Set value to matrix of zeros.
283  void zeros() {
284  value_.zeros();
285  }
286  // Set value to identity matrix.
287  void eye() {
288  value_.eye();
289  }
290  // Set value to matrix of ones.
291  void ones() {
292  value_.ones();
293  }
294  // Elementwise equivalence.
295  bool equal_to(const return_type &other) {
296  return arma::max(arma::max(arma::abs(value_ - other))) < 4*std::numeric_limits<ET>::epsilon();
297  }
298  // Multiplied value_ by double coefficient
299  void scale(double scale_coef) {
300  if (is_scalable())
301  for( unsigned int row=0; row<n_rows(); row++)
302  for( unsigned int col=0; col<n_cols(); col++)
303  value_.at(row,col) = scale_coef * value_.at(row,col);
304  }
305 
306 private:
307  return_type &value_;
308 };
309 
310 
311 
312 
313 
314 /// **********************************************************************
315 /// Specialization for scalars
316 template <class ET>
317 class FieldValue_<1,1,ET> {
318 public:
319  typedef ET element_type;
323  const static int NRows_ = 1;
324  const static int NCols_ = 1;
325  const static int rank_ = 0;
326 
327  static std::string type_name() { return "R"; }
329  {
330  return IT::Parameter("element_input_type");
331  }
332  static constexpr bool is_scalable() {
334  }
335 
336  inline FieldValue_(return_type &val) : value_(val) {}
337 
338  /**
339  * Returns reference to the return_type (i.e. double, or arma::vec or arma::mat); with data provided by the parameter @p raw_data.
340  * A reference to a work space @p val has to be provided for efficient work with vector and matrix values.
341  */
342  inline static const return_type &from_raw(return_type &val, ET *raw_data) {return internal::set_raw_scalar(val, raw_data);}
343  const ET * mem_ptr() const { return &(value_); }
344 
345  void init_from_input( AccessType val ) { value_ = return_type(val); }
346 
347  void set_n_comp(unsigned int) {};
348  inline unsigned int n_cols() const
349  { return 1; }
350  inline unsigned int n_rows() const
351  { return 1; }
352  inline ET &operator() ( unsigned int, unsigned int )
353  { return value_; }
354  inline ET operator() ( unsigned int i, unsigned int j) const
355  { return value_; }
356  inline operator return_type() const
357  { return value_;}
358 
359  // Set value to matrix of zeros.
360  void zeros() {
361  value_=0;
362  }
363  // Set value to identity matrix.
364  void eye() {
365  value_=1;
366  }
367  // Set value to matrix of ones.
368  void ones() {
369  value_=1;
370  }
371  bool equal_to(const return_type &other) {
372  return std::abs(value_ - other) < 4*std::numeric_limits<ET>::epsilon();
373  }
374  // Multiplied value_ by double coefficient
375  void scale(double scale_coef) {
376  if (is_scalable())
377  value_ = scale_coef * value_;
378  }
379 
380 private:
381  return_type &value_;
382 };
383 
384 
385 
386 
387 /// **********************************************************************
388 /// Specialization for variable size vectors
389 template <class ET>
390 class FieldValue_<0,1,ET> {
391 public:
392  typedef ET element_type;
396  const static int NRows_ = 0;
397  const static int NCols_ = 1;
398  const static int rank_ = 10;
399 
400 
401  static std::string type_name() { return "R[n]"; }
403  return IT::Array( IT::Parameter("element_input_type"), 1);
404  }
405  static constexpr bool is_scalable() {
407  }
408  inline static const return_type &from_raw(return_type &val, ET *raw_data) {return internal::set_raw_vec(val, raw_data);}
409  const ET * mem_ptr() const { return value_.memptr(); }
410 
411  inline FieldValue_(return_type &val) : value_(val) {}
412 
413 
414  void init_from_input( AccessType rec ) {
416  }
417 
418  void set_n_comp(unsigned int n_comp) { value_ = return_type(n_comp,1); };
419  inline unsigned int n_cols() const
420  { return 1; }
421  inline unsigned int n_rows() const
422  { return value_.n_rows; }
423  inline ET &operator() ( unsigned int i, unsigned int )
424  { return value_.at(i); }
425  inline ET operator() ( unsigned int i, unsigned int j) const
426  { return value_.at(i); }
427 
428  inline operator return_type() const
429  { return value_;}
430 
431  // Set value to matrix of zeros.
432  void zeros() {
433  value_.zeros();
434  }
435  // Set value to identity matrix.
436  void eye() {
437  value_.ones();
438  }
439  // Set value to matrix of ones.
440  void ones() {
441  value_.ones();
442  }
443  // Elementwise equivalence.
444  bool equal_to(const return_type &other) {
445  return arma::max(arma::abs(value_ - other)) < 4*std::numeric_limits<ET>::epsilon();
446  }
447  // Multiplied value_ by double coefficient
448  void scale(double scale_coef) {
449  if (is_scalable())
450  for(unsigned int i=0; i< n_rows(); i++) {
451  value_.at(i) = scale_coef * value_.at(i);
452  }
453  }
454 
455 
456 private:
457  return_type &value_;
458 };
459 
460 /// **********************************************************************
461 /// Specialization for fixed size vectors
462 template <int NRows, class ET>
463 class FieldValue_<NRows,1,ET> {
464 public:
465  typedef ET element_type;
469  const static int NRows_ = NRows;
470  const static int NCols_ = 1;
471  const static int rank_ = 1;
472 
473 
474  static std::string type_name() { return boost::str(boost::format("R[%d]") % NRows ); }
476  return IT::Array( IT::Parameter("element_input_type"), 1, NRows);
477  }
478  static constexpr bool is_scalable() {
480  }
481 
482  inline FieldValue_(return_type &val) : value_(val) {}
483  inline static const return_type &from_raw(return_type &val, ET *raw_data) {return internal::set_raw_fix(val, raw_data);}
484  const ET * mem_ptr() const { return value_.memptr(); }
485 
486  void init_from_input( AccessType rec ) {
488  }
489 
490  void set_n_comp(unsigned int) {};
491  inline unsigned int n_cols() const
492  { return 1; }
493  inline unsigned int n_rows() const
494  { return NRows; }
495  inline ET &operator() ( unsigned int i, unsigned int )
496  { return value_.at(i); }
497  inline ET operator() ( unsigned int i, unsigned int j) const
498  { return value_.at(i); }
499 
500  inline operator return_type() const
501  { return value_;}
502 
503  // Set value to matrix of zeros.
504  void zeros() {
505  value_.zeros();
506  }
507  // Set value to identity matrix.
508  void eye() {
509  value_.ones();
510  }
511  // Set value to matrix of ones.
512  void ones() {
513  value_.ones();
514  }
515  // Elementwise equivalence.
516  bool equal_to(const return_type &other) {
517  return arma::max(arma::abs(value_ - other)) < 4*std::numeric_limits<ET>::epsilon();
518  }
519  // Multiplied value_ by double coefficient
520  void scale(double scale_coef) {
521  if (is_scalable())
522  for(unsigned int i=0; i< n_rows(); i++) {
523  value_.at(i) = scale_coef * value_.at(i);
524  }
525  }
526 
527 private:
528  return_type &value_;
529 };
530 
531 
532 
533 //****************************************************************************
534 // string tensor (for FieldFormula)
535 
536 
537 /**
538  * Mimics arma::mat<std::string>. Used in FieldFormula
539  */
541 public:
542  typedef std::string elem_type;
543 
544  StringTensor( unsigned int n_rows, unsigned int n_cols )
545  : n_rows(n_rows),n_cols(n_cols), values_(n_rows*n_cols) {}
546 
547  std::string & at(unsigned int row) { return at(row,0); }
548  std::string & at(unsigned int row, unsigned int col) { return values_[col*n_rows+row]; }
549 
550  void zeros() {
551  for( auto &elem: values_) elem = "0.0";
552  }
553  unsigned int n_rows;
554  unsigned int n_cols;
555 private:
557 
558 };
559 
560 
561 template<int NRows, int NCols>
563 {
566  if (NRows == NCols) {
567  // for square tensors allow initialization by diagonal vector, etc.
568  return IT::Array( IT::Array( IT::String(), 1), 1 );
569  }
570  else {
571  return IT::Array( IT::Array( IT::String(), NCols, NCols), NRows, NRows );
572  }
573 
574  }
575 
576  static void init_from_input(StringTensor &tensor, AccessType input) {
577  internal::init_matrix_from_input(tensor, input);
578  }
579 };
580 
581 template<>
582 struct StringTensorInput<1,1> {
583  typedef std::string AccessType;
584  static IT::String get_input_type() { return IT::String(); }
585  static void init_from_input(StringTensor &tensor, AccessType input) {
586  tensor.at(0,0) = input;
587  }
588 };
589 
590 template<int Nrows>
591 struct StringTensorInput<Nrows,1> {
594  return IT::Array( IT::String(), 1);
595  }
596  static void init_from_input(StringTensor &tensor, AccessType input) {
597  internal::init_vector_from_input(tensor, input);
598  }
599 };
600 
601 
602 
603 
604 /**
605  * Class that provides common template-less interface to all templated Field structes.
606  *
607  * Maybe we can delete this since common interface will be given by "Quantity".
608  */
609 
610 template <int spacedim>
611 struct FieldValue {
612  // typedefs for possible field values
621 };
622 
623 
624 
625 
626 
627 
628 
629 
630 
631 
632 #endif /* FIELD_VALUES_HH_ */
void init_from_input(AccessType val)
internal::ReturnType< 1, 1, ET >::return_type return_type
Iterator< ValueType > begin() const
internal::InputType< ET >::type ElementInputType
Accessor to input data conforming to declared Array.
Definition: accessors.hh:567
static const return_type & from_raw(return_type &val, ET *raw_data)
static IT::Array get_input_type()
EI_Address ei_address() const
Definition: accessors.cc:314
void set_n_comp(unsigned int)
arma::Col< unsigned int > return_type
Definition: field_values.hh:94
std::vector< std::string > values_
static void init_from_input(StringTensor &tensor, AccessType input)
internal::InputType< ET >::type ElementInputType
static void init_from_input(StringTensor &tensor, AccessType input)
bool equal_to(const return_type &other)
FieldValue_< 0, 1, int > IntVector
static const return_type & from_raw(return_type &val, ET *raw_data)
void set_n_comp(unsigned int n_comp)
std::string format(CStringRef format_str, ArgList args)
Definition: format.h:3141
const ET * mem_ptr() const
void set_n_comp(unsigned int)
void init_from_input(AccessType rec)
void scale(double scale_coef)
Class for representing parametric types in IST.
Definition: type_generic.hh:53
static std::string type_name()
RT & set_raw_vec(RT &val, double *raw_data)
void set_n_comp(unsigned int)
unsigned int n_cols() const
internal::ReturnType< NRows, NCols, ET >::return_type return_type
FieldValue_(return_type &val)
void init_from_input(AccessType rec)
Input::Type::Selection type
Definition: field_values.hh:66
FieldValue_< 1, 1, FieldEnum > Enum
Class for declaration of the integral input data.
Definition: type_base.hh:489
void init_matrix_from_input(MatrixType &value, Input::Array rec)
void init_from_input(AccessType rec)
Class for declaration of inputs sequences.
Definition: type_base.hh:345
static constexpr bool value
Definition: json.hpp:87
arma::Col< unsigned int >::template fixed< NRows > return_type
Definition: field_values.hh:97
StringTensor(unsigned int n_rows, unsigned int n_cols)
internal::InputType< ET >::type ElementInputType
static IT::Array get_input_type()
Class for declaration of the input data that are floating point numbers.
Definition: type_base.hh:540
static std::string type_name()
FieldValue_< 0, 1, FieldEnum > EnumVector
std::string elem_type
unsigned int FieldEnum
Definition: field_values.hh:43
const ET * mem_ptr() const
static constexpr bool is_scalable()
unsigned int n_rows
internal::InputType< ET >::type ElementInputType
const ET * mem_ptr() const
internal::ReturnType< NRows, 1, ET >::return_type return_type
void scale(double scale_coef)
bool equal_to(const return_type &other)
static constexpr bool is_scalable()
return_type & value_
std::string & at(unsigned int row, unsigned int col)
FieldValue_< spacedim, 1, double > VectorFixed
bool equal_to(const return_type &other)
static IT::Array get_input_type()
void init_vector_from_input(VectorType &value, Input::Array rec)
static std::string type_name()
unsigned int n_rows() const
RT & set_raw_fix(RT &val, double *raw_data)
arma::Mat< ET >::template fixed< NRows, NCols > return_type
Definition: field_values.hh:74
static void init_from_input(StringTensor &tensor, AccessType input)
internal::ReturnType< 0, 1, ET >::return_type return_type
static constexpr bool is_scalable()
TYPEDEF_ERR_INFO(EI_InputMsg, const string)
std::string & at(unsigned int row)
const double epsilon
Definition: mathfce.h:23
unsigned int n_cols() const
static IT::Array get_input_type()
unsigned int n_rows() const
Input::Type::Integer type
Definition: field_values.hh:63
arma::Mat< unsigned int >::template fixed< NRows, NCols > return_type
Definition: field_values.hh:88
unsigned int n_cols() const
void scale(double scale_coef)
Input::Type::Double type
Definition: field_values.hh:60
unsigned int n_cols
FieldValue_< 1, 1, int > Integer
FieldValue_(return_type &val)
FieldValue_< 0, 1, double > Vector
internal::AccessTypeDispatch< ET >::type AccessType
static std::string type_name()
DECLARE_INPUT_EXCEPTION(ExcFV_Input,<< "Wrong field value input: "<< EI_InputMsg::val)
static const return_type & from_raw(return_type &val, ET *raw_data)
FieldValue_(return_type &val)
static IT::Array get_input_type()
void scale(double scale_coef)
unsigned int size() const
Input::Array AccessType
static const return_type & from_raw(return_type &val, ET *raw_data)
FieldValue_< spacedim, spacedim, double > TensorFixed
unsigned int n_rows() const
Input::Array AccessType
unsigned int n_cols() const
arma::Col< ET >::template fixed< NRows > return_type
Definition: field_values.hh:83
RT & set_raw_scalar(RT &val, double *raw_data)
Class for declaration of the input data that are in string format.
Definition: type_base.hh:588
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
Definition: exceptions.hh:53
static IT::Parameter get_input_type()
Template for classes storing finite set of named values.
static IT::String get_input_type()
FieldValue_< 1, 1, double > Scalar
const ET * mem_ptr() const
bool equal_to(const return_type &other)
FieldValue_(return_type &val)
unsigned int n_rows() const
static constexpr bool is_scalable()