Flow123d  release_2.2.0-34-g18a8075
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 
243  static std::string type_name() { return boost::str(boost::format("R[%d,%d]") % NRows % NCols); }
245  if (NRows == NCols) {
246  // for square tensors allow initialization by diagonal vector, etc.
247  return IT::Array( IT::Array( IT::Parameter("element_input_type"), 1), 1 );
248  }
249  else {
250  return IT::Array( IT::Array( IT::Parameter("element_input_type"), NCols, NCols), NRows, NRows );
251  }
252 
253  }
254  static constexpr bool is_scalable() {
256  }
257 
258 
259  inline FieldValue_(return_type &val) : value_(val) {}
260  inline static const return_type &from_raw(return_type &val, ET *raw_data) {return internal::set_raw_fix(val, raw_data);}
261  const ET * mem_ptr() const {
262  return value_.memptr();
263  }
264 
265  void init_from_input( AccessType rec ) {
267  }
268 
269  void set_n_comp(unsigned int) {};
270  inline unsigned int n_cols() const
271  { return NCols; }
272  inline unsigned int n_rows() const
273  { return NRows; }
274  inline ET &operator() ( unsigned int i, unsigned int j)
275  { return value_.at(i,j); }
276  inline ET operator() ( unsigned int i, unsigned int j) const
277  { return value_.at(i,j); }
278  inline operator return_type() const
279  { return value_;}
280 
281  // Set value to matrix of zeros.
282  void zeros() {
283  value_.zeros();
284  }
285  // Set value to identity matrix.
286  void eye() {
287  value_.eye();
288  }
289  // Set value to matrix of ones.
290  void ones() {
291  value_.ones();
292  }
293  // Elementwise equivalence.
294  bool equal_to(const return_type &other) {
295  return arma::max(arma::max(arma::abs(value_ - other))) < 4*std::numeric_limits<ET>::epsilon();
296  }
297  // Multiplied value_ by double coefficient
298  void scale(double scale_coef) {
299  if (is_scalable())
300  for( unsigned int row=0; row<n_rows(); row++)
301  for( unsigned int col=0; col<n_cols(); col++)
302  value_.at(row,col) = scale_coef * value_.at(row,col);
303  }
304 
305 private:
306  return_type &value_;
307 };
308 
309 
310 
311 
312 
313 /// **********************************************************************
314 /// Specialization for scalars
315 template <class ET>
316 class FieldValue_<1,1,ET> {
317 public:
318  typedef ET element_type;
322  const static int NRows_ = 1;
323  const static int NCols_ = 1;
324 
325  static std::string type_name() { return "R"; }
327  {
328  return IT::Parameter("element_input_type");
329  }
330  static constexpr bool is_scalable() {
332  }
333 
334  inline FieldValue_(return_type &val) : value_(val) {}
335 
336  /**
337  * Returns reference to the return_type (i.e. double, or arma::vec or arma::mat); with data provided by the parameter @p raw_data.
338  * A reference to a work space @p val has to be provided for efficient work with vector and matrix values.
339  */
340  inline static const return_type &from_raw(return_type &val, ET *raw_data) {return internal::set_raw_scalar(val, raw_data);}
341  const ET * mem_ptr() const { return &(value_); }
342 
343  void init_from_input( AccessType val ) { value_ = return_type(val); }
344 
345  void set_n_comp(unsigned int) {};
346  inline unsigned int n_cols() const
347  { return 1; }
348  inline unsigned int n_rows() const
349  { return 1; }
350  inline ET &operator() ( unsigned int, unsigned int )
351  { return value_; }
352  inline ET operator() ( unsigned int i, unsigned int j) const
353  { return value_; }
354  inline operator return_type() const
355  { return value_;}
356 
357  // Set value to matrix of zeros.
358  void zeros() {
359  value_=0;
360  }
361  // Set value to identity matrix.
362  void eye() {
363  value_=1;
364  }
365  // Set value to matrix of ones.
366  void ones() {
367  value_=1;
368  }
369  bool equal_to(const return_type &other) {
370  return std::abs(value_ - other) < 4*std::numeric_limits<ET>::epsilon();
371  }
372  // Multiplied value_ by double coefficient
373  void scale(double scale_coef) {
374  if (is_scalable())
375  value_ = scale_coef * value_;
376  }
377 
378 private:
379  return_type &value_;
380 };
381 
382 
383 
384 
385 /// **********************************************************************
386 /// Specialization for variable size vectors
387 template <class ET>
388 class FieldValue_<0,1,ET> {
389 public:
390  typedef ET element_type;
394  const static int NRows_ = 0;
395  const static int NCols_ = 1;
396 
397 
398  static std::string type_name() { return "R[n]"; }
400  return IT::Array( IT::Parameter("element_input_type"), 1);
401  }
402  static constexpr bool is_scalable() {
404  }
405  inline static const return_type &from_raw(return_type &val, ET *raw_data) {return internal::set_raw_vec(val, raw_data);}
406  const ET * mem_ptr() const { return value_.memptr(); }
407 
408  inline FieldValue_(return_type &val) : value_(val) {}
409 
410 
411  void init_from_input( AccessType rec ) {
413  }
414 
415  void set_n_comp(unsigned int n_comp) { value_ = return_type(n_comp,1); };
416  inline unsigned int n_cols() const
417  { return 1; }
418  inline unsigned int n_rows() const
419  { return value_.n_rows; }
420  inline ET &operator() ( unsigned int i, unsigned int )
421  { return value_.at(i); }
422  inline ET operator() ( unsigned int i, unsigned int j) const
423  { return value_.at(i); }
424 
425  inline operator return_type() const
426  { return value_;}
427 
428  // Set value to matrix of zeros.
429  void zeros() {
430  value_.zeros();
431  }
432  // Set value to identity matrix.
433  void eye() {
434  value_.ones();
435  }
436  // Set value to matrix of ones.
437  void ones() {
438  value_.ones();
439  }
440  // Elementwise equivalence.
441  bool equal_to(const return_type &other) {
442  return arma::max(arma::abs(value_ - other)) < 4*std::numeric_limits<ET>::epsilon();
443  }
444  // Multiplied value_ by double coefficient
445  void scale(double scale_coef) {
446  if (is_scalable())
447  for(unsigned int i=0; i< n_rows(); i++) {
448  value_.at(i) = scale_coef * value_.at(i);
449  }
450  }
451 
452 
453 private:
454  return_type &value_;
455 };
456 
457 /// **********************************************************************
458 /// Specialization for fixed size vectors
459 template <int NRows, class ET>
460 class FieldValue_<NRows,1,ET> {
461 public:
462  typedef ET element_type;
466  const static int NRows_ = NRows;
467  const static int NCols_ = 1;
468 
469 
470  static std::string type_name() { return boost::str(boost::format("R[%d]") % NRows ); }
472  return IT::Array( IT::Parameter("element_input_type"), 1, NRows);
473  }
474  static constexpr bool is_scalable() {
476  }
477 
478  inline FieldValue_(return_type &val) : value_(val) {}
479  inline static const return_type &from_raw(return_type &val, ET *raw_data) {return internal::set_raw_fix(val, raw_data);}
480  const ET * mem_ptr() const { return value_.memptr(); }
481 
482  void init_from_input( AccessType rec ) {
484  }
485 
486  void set_n_comp(unsigned int) {};
487  inline unsigned int n_cols() const
488  { return 1; }
489  inline unsigned int n_rows() const
490  { return NRows; }
491  inline ET &operator() ( unsigned int i, unsigned int )
492  { return value_.at(i); }
493  inline ET operator() ( unsigned int i, unsigned int j) const
494  { return value_.at(i); }
495 
496  inline operator return_type() const
497  { return value_;}
498 
499  // Set value to matrix of zeros.
500  void zeros() {
501  value_.zeros();
502  }
503  // Set value to identity matrix.
504  void eye() {
505  value_.ones();
506  }
507  // Set value to matrix of ones.
508  void ones() {
509  value_.ones();
510  }
511  // Elementwise equivalence.
512  bool equal_to(const return_type &other) {
513  return arma::max(arma::abs(value_ - other)) < 4*std::numeric_limits<ET>::epsilon();
514  }
515  // Multiplied value_ by double coefficient
516  void scale(double scale_coef) {
517  if (is_scalable())
518  for(unsigned int i=0; i< n_rows(); i++) {
519  value_.at(i) = scale_coef * value_.at(i);
520  }
521  }
522 
523 private:
524  return_type &value_;
525 };
526 
527 
528 
529 //****************************************************************************
530 // string tensor (for FieldFormula)
531 
532 
533 /**
534  * Mimics arma::mat<std::string>. Used in FieldFormula
535  */
537 public:
538  typedef std::string elem_type;
539 
540  StringTensor( unsigned int n_rows, unsigned int n_cols )
541  : n_rows(n_rows),n_cols(n_cols), values_(n_rows*n_cols) {}
542 
543  std::string & at(unsigned int row) { return at(row,0); }
544  std::string & at(unsigned int row, unsigned int col) { return values_[col*n_rows+row]; }
545 
546  void zeros() {
547  for( auto &elem: values_) elem = "0.0";
548  }
549  unsigned int n_rows;
550  unsigned int n_cols;
551 private:
553 
554 };
555 
556 
557 template<int NRows, int NCols>
559 {
562  if (NRows == NCols) {
563  // for square tensors allow initialization by diagonal vector, etc.
564  return IT::Array( IT::Array( IT::String(), 1), 1 );
565  }
566  else {
567  return IT::Array( IT::Array( IT::String(), NCols, NCols), NRows, NRows );
568  }
569 
570  }
571 
572  static void init_from_input(StringTensor &tensor, AccessType input) {
573  internal::init_matrix_from_input(tensor, input);
574  }
575 };
576 
577 template<>
578 struct StringTensorInput<1,1> {
579  typedef std::string AccessType;
580  static IT::String get_input_type() { return IT::String(); }
581  static void init_from_input(StringTensor &tensor, AccessType input) {
582  tensor.at(0,0) = input;
583  }
584 };
585 
586 template<int Nrows>
587 struct StringTensorInput<Nrows,1> {
590  return IT::Array( IT::String(), 1);
591  }
592  static void init_from_input(StringTensor &tensor, AccessType input) {
593  internal::init_vector_from_input(tensor, input);
594  }
595 };
596 
597 
598 
599 
600 /**
601  * Class that provides common template-less interface to all templated Field structes.
602  *
603  * Maybe we can delete this since common interface will be given by "Quantity".
604  */
605 
606 template <int spacedim>
607 struct FieldValue {
608  // typedefs for possible field values
617 };
618 
619 
620 
621 
622 
623 
624 
625 
626 
627 
628 #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()