Flow123d  master-8d5574fc2
field_formula.cc
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_formula.cc
15  * @brief
16  */
17 
18 
19 
20 #include "fields/field_formula.hh"
21 #include "fields/field_instances.hh" // for instantiation macros
22 #include "fields/surface_depth.hh"
23 #include "fparser.hh"
24 #include "input/input_type.hh"
25 #include "include/arena_alloc.hh" // bparser
26 #include <boost/algorithm/string/replace.hpp>
27 #include <boost/regex.hpp>
28 
29 
30 
31 /// Implementation.
32 
33 namespace it = Input::Type;
34 
35 FLOW123D_FORCE_LINK_IN_CHILD(field_formula)
36 
37 
38 template <int spacedim, class Value>
40 {
41 
42  return it::Record("FieldFormula", FieldAlgorithmBase<spacedim,Value>::template_name()+" Field given by runtime interpreted formula.")
45  .declare_key("value", STI::get_input_type() , it::Default::obligatory(),
46  "String, array of strings, or matrix of strings with formulas for individual "
47  "entries of scalar, vector, or tensor value respectively.\n"
48  "For vector values, you can use just one string to enter homogeneous vector.\n"
49  "For square (($N\\times N$))-matrix values, you can use:\n\n"
50  " - array of strings of size (($N$)) to enter diagonal matrix\n"
51  " - array of strings of size (($\\frac12N(N+1)$)) to enter symmetric matrix (upper triangle, row by row)\n"
52  " - just one string to enter (spatially variable) multiple of the unit matrix.\n"
53  "Formula can contain variables ```x,y,z,t,d``` and usual operators and functions." )
54  //.declare_key("unit", FieldAlgorithmBase<spacedim, Value>::get_input_type_unit_si(), it::Default::optional(),
55  // "Definition of unit.")
56  .declare_key("surface_direction", it::String(), it::Default("\"0 0 1\""),
57  "The vector used to project evaluation point onto the surface.")
58  .declare_key("surface_region", it::String(), it::Default::optional(),
59  "The name of region set considered as the surface. You have to set surface region if you "
60  "want to use formula variable ```d```.")
61  .allow_auto_conversion("value")
62  .close();
63 }
64 
65 
66 
67 template <int spacedim, class Value>
69  Input::register_class< FieldFormula<spacedim, Value>, unsigned int >("FieldFormula") +
71 
72 
73 
74 template <int spacedim, class Value>
76 : FieldAlgorithmBase<spacedim, Value>(n_comp),
77  formula_matrix_(this->value_.n_rows(), this->value_.n_cols()),
78  first_time_set_(true), arena_alloc_(nullptr)
79 {
80  this->is_constant_in_space_ = false;
81  parser_matrix_.resize(this->value_.n_rows());
82  for(unsigned int row=0; row < this->value_.n_rows(); row++) {
83  parser_matrix_[row].resize(this->value_.n_cols());
84  }
85  b_parser_.reserve(this->value_.n_rows()*this->value_.n_cols());
86  for(unsigned int i=0; i < this->value_.n_rows()*this->value_.n_cols(); i++) {
87  b_parser_.emplace_back( 1.1 * CacheMapElementNumber::get() );
88  }
89 }
90 
91 
92 
93 template <int spacedim, class Value>
95  this->init_unit_conversion_coefficient(rec, init_data);
96 
97  // read formulas form input
98  STI::init_from_input( formula_matrix_, rec.val<typename STI::AccessType>("value") );
99  in_rec_ = rec;
100 }
101 
102 
103 template <int spacedim, class Value>
105 
106  if (!time.use_fparser_) {
107  this->time_=time;
108  this->is_constant_in_space_ = false;
109  return true;
110  }
111 
112  /* OLD FPARSER CODE */
113  bool any_parser_changed = false;
114  std::string value_input_address = in_rec_.address_string();
115  has_depth_var_ = false;
116  this->is_constant_in_space_ = true; // set flag to true, then if found 'x', 'y', 'z' or 'd' reset to false
117 
118 
119  std::string vars = string("x,y,z").substr(0, 2*spacedim-1);
120  std::vector<bool> time_dependent(this->value_.n_rows() * this->value_.n_cols(), false);
121  // update parsers
122  for(unsigned int row=0; row < this->value_.n_rows(); row++)
123  for(unsigned int col=0; col < this->value_.n_cols(); col++) {
124  // get all variable names from the formula
125  std::vector<std::string> var_list;
126 
127  FunctionParser tmp_parser;
128  tmp_parser.AddConstant("Pi", 3.14159265358979323846);
129  tmp_parser.AddConstant("E", 2.71828182845904523536);
130 
131 
132 #pragma GCC diagnostic push
133 #pragma GCC diagnostic ignored "-Wunused-variable"
134  {
135  int err=tmp_parser.ParseAndDeduceVariables(formula_matrix_.at(row,col), var_list);
136  ASSERT_PERMANENT(err != FunctionParser::FP_NO_ERROR)(tmp_parser.ErrorMsg()).error("ParseAndDeduceVariables error\n");
137  }
138 #pragma GCC diagnostic pop
139 
140  for(std::string &var_name : var_list ) {
141  if (var_name == std::string("t") ) time_dependent[row*this->value_.n_rows()+col]=true;
142  else if (var_name == std::string("d") ) {
143  this->is_constant_in_space_ = false;
144  if (surface_depth_)
145  has_depth_var_=true;
146  else
147  WarningOut().fmt("Unset surface region. Variable '{}' in the FieldFormula[{}][{}] == '{}' will be set to zero\n at the input address:\n {} \n",
148  var_name, row, col, formula_matrix_.at(row,col), value_input_address );
149  }
150  else if (var_name == "x" || var_name == "y" || var_name == "z") {
151  this->is_constant_in_space_ = false;
152  continue;
153  }
154  else
155  WarningOut().fmt("Unknown variable '{}' in the FieldFormula[{}][{}] == '{}'\n at the input address:\n {} \n",
156  var_name, row, col, formula_matrix_.at(row,col), value_input_address );
157  }
158 
159  // Seems that we can not just add 't' constant to tmp_parser, since it was already Parsed.
160  parser_matrix_[row][col].AddConstant("Pi", 3.14159265358979323846);
161  parser_matrix_[row][col].AddConstant("E", 2.71828182845904523536);
162  if (time_dependent[row*this->value_.n_rows()+col]) {
163  parser_matrix_[row][col].AddConstant("t", time.end());
164  }
165  }
166 
167  if (has_depth_var_)
168  vars += string(",d");
169 
170  // update parsers
171  for(unsigned int row=0; row < this->value_.n_rows(); row++)
172  for(unsigned int col=0; col < this->value_.n_cols(); col++) {
173  // TODO:
174  // - possibly add user defined constants and units here ...
175  // - optimization; possibly parse only if time_dependent || formula_matrix[][] has changed ...
176  //parser_matrix_[row][col] = tmp_parser;
177  if (time_dependent[row*this->value_.n_rows()+col] || first_time_set_ ) {
178  parser_matrix_[row][col].Parse(formula_matrix_.at(row,col), vars);
179 
180  if ( parser_matrix_[row][col].GetParseErrorType() != FunctionParser::FP_NO_ERROR ) {
181  THROW( ExcFParserError() << EI_FParserMsg(parser_matrix_[row][col].ErrorMsg()) << EI_Row(row)
182  << EI_Col(col) << EI_Formula(formula_matrix_.at(row,col)) );
183  }
184 
185  parser_matrix_[row][col].Optimize();
186  any_parser_changed = true;
187  }
188 
189 
190  }
191 
192  first_time_set_ = false;
193  this->time_=time;
194  return any_parser_changed;
195 }
196 
197 
198 template <int spacedim, class Value>
199 void FieldFormula<spacedim, Value>::set_mesh(const Mesh *mesh, FMT_UNUSED bool boundary_domain) {
200  // create SurfaceDepth object if surface region is set
201  std::string surface_region;
202  if ( in_rec_.opt_val("surface_region", surface_region) ) {
203  surface_depth_ = std::make_shared<SurfaceDepth>(mesh, surface_region, in_rec_.val<std::string>("surface_direction"));
204  }
205 }
206 
207 
208 /**
209  * Returns one value in one given point. ResultType can be used to avoid some costly calculation if the result is trivial.
210  */
211 template <int spacedim, class Value>
212 typename Value::return_type const & FieldFormula<spacedim, Value>::value(const Point &p, FMT_UNUSED const ElementAccessor<spacedim> &elm)
213 {
214 
215  auto p_depth = this->eval_depth_var(p);
216  for(unsigned int row=0; row < this->value_.n_rows(); row++)
217  for(unsigned int col=0; col < this->value_.n_cols(); col++) {
218  this->value_(row,col) = this->unit_conversion_coefficient_ * parser_matrix_[row][col].Eval(p_depth.memptr());
219  }
220  return this->r_value_;
221 }
222 
223 
224 /**
225  * Returns std::vector of scalar values in several points at once.
226  */
227 template <int spacedim, class Value>
230 {
231  ASSERT_EQ( point_list.size(), value_list.size() );
232  ASSERT( point_list.n_rows() == spacedim && point_list.n_cols() == 1).error("Invalid point size.\n");
233  for(unsigned int i=0; i< point_list.size(); i++) {
234  Value envelope(value_list[i]);
235  ASSERT_EQ( envelope.n_rows(), this->value_.n_rows() )(i)(envelope.n_rows())(this->value_.n_rows())
236  .error("value_list['i'] has wrong number of rows\n");
237  auto p_depth = this->eval_depth_var(point_list.vec<spacedim>(i));
238 
239  for(unsigned int row=0; row < this->value_.n_rows(); row++)
240  for(unsigned int col=0; col < this->value_.n_cols(); col++) {
241  envelope(row,col) = this->unit_conversion_coefficient_ * parser_matrix_[row][col].Eval(p_depth.memptr());
242  }
243  }
244 }
245 
246 
247 template <int spacedim, class Value>
249  ElementCacheMap &cache_map, unsigned int region_patch_idx)
250 {
251  unsigned int reg_chunk_begin = cache_map.region_chunk_begin(region_patch_idx);
252  unsigned int reg_chunk_end = cache_map.region_chunk_end(region_patch_idx);
253 
254  for (unsigned int i=reg_chunk_begin; i<reg_chunk_end; ++i) {
255  res_[i] = 0.0;
256  }
257  for (auto it : eval_field_data_) {
258  // Copy data from dependent fields to arena. Temporary solution.
259  // TODO hold field data caches in arena, remove this step
260  auto value_cache = it.first->value_cache();
261  for (unsigned int i=reg_chunk_begin; i<reg_chunk_end; ++i) {
262  if (it.first->name() == "X") {
263  x_[i] = value_cache->template vec<3>(i)(0);
264  y_[i] = value_cache->template vec<3>(i)(1);
265  z_[i] = value_cache->template vec<3>(i)(2);
266  } else
267  it.second[i] = value_cache->data_[i];
268  }
269  }
270 
271  // Get vector of subsets as subarray
272  uint subsets_begin = reg_chunk_begin / ElementCacheMap::simd_size_double;
273  uint subsets_end = reg_chunk_end / ElementCacheMap::simd_size_double;
274  std::vector<uint> subset_vec;
275  subset_vec.assign(subsets_ + subsets_begin, subsets_ + subsets_end);
276 
277  for(unsigned int row=0; row < this->value_.n_rows(); row++)
278  for(unsigned int col=0; col < this->value_.n_cols(); col++) {
279  b_parser_[row*this->value_.n_cols()+col].set_subset(subset_vec);
280  b_parser_[row*this->value_.n_cols()+col].run();
281  for (unsigned int i=reg_chunk_begin; i<reg_chunk_end; ++i) {
282  auto cache_val = data_cache.template mat<Value::NRows_, Value::NCols_>(i);
283  cache_val(row, col) = res_[i];
284  data_cache.set(i) = cache_val;
285  }
286  }
287 }
288 
289 
290 template <int spacedim, class Value>
292 {
293  if (surface_depth_ && has_depth_var_) {
294  // add value of depth
295  arma::vec p_depth(spacedim+1);
296  p_depth.subvec(0,spacedim-1) = p;
297  try {
298  p_depth(spacedim) = surface_depth_->compute_distance(p);
299  } catch (SurfaceDepth::ExcTooLargeSnapDistance &e) {
300  e << SurfaceDepth::EI_FieldTime(this->time_.end());
301  e << in_rec_.ei_address();
302  throw;
303  }
304  return p_depth;
305  } else {
306  return p;
307  }
308 }
309 
311  uint r = 1;
312  for (auto i : shape) r *= i;
313  return r;
314 }
315 
316 
317 template <int spacedim, class Value>
319  required_fields_.clear(); // returned value
320 
321  std::vector<std::string> variables;
322  for(unsigned int row=0; row < this->value_.n_rows(); row++)
323  for(unsigned int col=0; col < this->value_.n_cols(); col++) {
324  // set expression and data to BParser
325  unsigned int i_p = row*this->value_.n_cols()+col;
326  //b_parser_[i_p].parse(formula_matrix_.at(row,col));
327  std::string expr = formula_matrix_.at(row,col); // Need replace some operations to make them compatible with BParser.
328  // It will be solved by conversion script after remove fparser, but
329  // we mix using of BParser and fparser and need this solution now.
330  boost::replace_all(expr, "^", "**"); // power function
331  boost::replace_all(expr, "max(", "maximum("); // max function
332  boost::replace_all(expr, "min(", "minimum("); // min function
333  boost::replace_all(expr, "Pi", "pi"); // Math.pi
334  boost::replace_all(expr, "E", "e"); // Math.e
335  boost::replace_all(expr, "!", "not");
336  boost::replace_all(expr, "=", "==");
337  boost::replace_all(expr, "<==", "<=");
338  boost::replace_all(expr, ">==", ">=");
339  boost::replace_all(expr, ":=", "=");
340  boost::replace_all(expr, "&", " and ");
341  boost::replace_all(expr, "|", " or ");
342  {
343 
344  // Regexp tested with perl syntax, first is matched the inner most if
345  boost::regex r(R"((.*)(if\()((?<RR>(?:[^()]*)|((?:[^()]*)\((?&RR)\)(?:[^()]*))*)),((?&RR)),((?&RR))(\))(.*))");
346  boost::smatch res;
347  while (1) {
348  if (! boost::regex_match(expr, res, r)) break;
349  std::string tmp = res[1].str() + "((" + res[6].str() + ") if (" + res[3].str() + ") else (" + res[7].str() + "))" + res[9].str();
350  expr = tmp;
351  }
352  DebugOut() << "After fparser translation to BParser: " << expr << "\n";
353 /*
354 
355 
356  // ternary operator
357  std::regex
358  std::string pref("if(");
359  auto res = std::mismatch(pref.begin(), pref.end(), expr.begin());
360  if ( (res.first == pref.end()) && (expr.back() == ')') ) {
361  std::string subexpr = expr.substr(3, expr.size()-4);
362  std::string delimiter = ",";
363  std::string cond = subexpr.substr(0, subexpr.find(delimiter));
364  subexpr.erase(0, cond.size()+1);
365  std::string if_case = subexpr.substr(0, subexpr.find(delimiter));
366  std::string else_case = subexpr.substr(if_case.size()+1);
367  expr = "(" + if_case + " if " + cond + " else " + else_case +")";
368  }
369 */
370  }
371  try {
372  b_parser_[i_p].parse( expr );
373  } catch (std::exception const& e) {
374  if (typeid(e) == typeid(bparser::Exception))
375  THROW( ExcParserError() << EI_BParserMsg(e.what()) << EI_Formula(expr) << Input::EI_Address( in_rec_.address_string() ) );
376  else throw;
377  }
378  auto list = b_parser_[i_p].free_symbols();
379  variables.insert(variables.end(), list.begin(), list.end());
380  }
381 
382  std::sort( variables.begin(), variables.end() );
383  variables.erase( std::unique( variables.begin(), variables.end() ), variables.end() );
384  has_time_=false;
385  sum_shape_sizes_=0; // scecifies size of arena
386  for (auto var : variables) {
387  if (var == "x" || var == "y" || var == "z") {
388  required_fields_.push_back( field_set.field("X") );
389  sum_shape_sizes_ += spacedim;
390  }
391  else if (var == "t") has_time_ = true;
392  else {
393  auto field_ptr = field_set.field(var);
394  if (field_ptr != nullptr) required_fields_.push_back( field_ptr );
395  else {
396  field_ptr = field_set.user_field(var, this->time_);
397  if (field_ptr != nullptr) required_fields_.push_back( field_ptr );
398  else THROW( ExcUnknownField() << EI_Field(var) << Input::EI_Address( in_rec_.address_string() ) );
399  }
400  // TODO: Test the exception, report input line of the formula.
401  if (field_ptr->value_cache() == nullptr) THROW( ExcNotDoubleField() << EI_Field(var) << Input::EI_Address( in_rec_.address_string() ) );
402  // TODO: Test the exception, report input line of the formula.
403 
404  sum_shape_sizes_ += n_shape( field_ptr->shape_ );
405  if (var == "d") {
406  field_set.set_surface_depth(this->surface_depth_);
407  }
408  }
409  }
410 
411  return required_fields_;
412 }
413 
414 
415 template <int spacedim, class Value>
417 {
418  if (arena_alloc_!=nullptr) {
419  delete arena_alloc_;
420  }
421  eval_field_data_.clear();
422  uint vec_size = 1.1 * CacheMapElementNumber::get();
423  while (vec_size%ElementCacheMap::simd_size_double > 0) vec_size++; // alignment of block size
424  // number of subset alignment to block size
426  uint n_vectors = sum_shape_sizes_ + 1; // needs add space of result vector
427  arena_alloc_ = new bparser::ArenaAlloc(ElementCacheMap::simd_size_double, n_vectors * vec_size * sizeof(double) + n_subsets * sizeof(uint));
428  res_ = arena_alloc_->create_array<double>(vec_size);
429  for (auto field : required_fields_) {
430  std::string field_name = field->name();
431  eval_field_data_[field] = arena_alloc_->create_array<double>(n_shape( field->shape_ ) * vec_size);
432  if (field_name == "X") {
433  x_ = eval_field_data_[field] + 0;
434  y_ = eval_field_data_[field] + vec_size;
435  z_ = eval_field_data_[field] + 2*vec_size;
436  }
437  }
438  subsets_ = arena_alloc_->create_array<uint>(n_subsets);
439 
440  for(unsigned int row=0; row < this->value_.n_rows(); row++)
441  for(unsigned int col=0; col < this->value_.n_cols(); col++) {
442  // set expression and data to BParser
443  unsigned int i_p = row*this->value_.n_cols()+col;
444  if (has_time_) {
445  b_parser_[i_p].set_constant("t", {}, {this->time_.end()});
446  }
447  for (auto field : required_fields_) {
448  std::string field_name = field->name();
449  if (field_name == "X") {
450  b_parser_[i_p].set_variable("x", {}, x_);
451  b_parser_[i_p].set_variable("y", {}, y_);
452  b_parser_[i_p].set_variable("z", {}, z_);
453  } else
454  b_parser_[i_p].set_variable(field_name, {}, eval_field_data_[field]);
455  }
456  b_parser_[i_p].set_variable("_result_", {}, res_);
457  b_parser_[i_p].compile();
458  }
459  for (uint i=0; i<n_subsets; ++i)
460  subsets_[i] = i;
461 }
462 
463 
464 template <int spacedim, class Value>
466 
467 
468 // Instantiations of FieldFormula
surface_depth.hh
CacheMapElementNumber::get
static unsigned int get()
Return number of stored elements.
Definition: field_value_cache.hh:93
FieldFormula::eval_depth_var
arma::vec eval_depth_var(const Point &p)
Definition: field_formula.cc:291
Armor::vec
ArmaVec< double, N > vec
Definition: armor.hh:885
FieldFormula::b_parser_
std::vector< bparser::Parser > b_parser_
Definition: field_formula.hh:151
ASSERT
#define ASSERT(expr)
Definition: asserts.hh:350
ElementCacheMap::simd_size_double
static const unsigned int simd_size_double
Definition: field_value_cache.hh:158
ElementCacheMap
Directing class of FieldValueCache.
Definition: field_value_cache.hh:151
Input::Record::val
const Ret val(const string &key) const
Definition: accessors_impl.hh:31
Armor::Array::vec
ArmaVec< Type, nr > vec(uint mat_index) const
Definition: armor.hh:821
FieldFormula::cache_update
void cache_update(FieldValueCache< typename Value::element_type > &data_cache, ElementCacheMap &cache_map, unsigned int region_patch_idx) override
Definition: field_formula.cc:248
FieldSet::user_field
FieldCommon * user_field(const std::string &field_name, const TimeStep &time)
Definition: field_set.cc:176
FLOW123D_FORCE_LINK_IN_CHILD
#define FLOW123D_FORCE_LINK_IN_CHILD(x)
Definition: global_defs.h:104
THROW
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
Definition: exceptions.hh:53
FieldAlgorithmBase::is_constant_in_space_
bool is_constant_in_space_
Flag detects that field is only dependent on time.
Definition: field_algo_base.hh:289
std::vector< bool >
ElementAccessor
Definition: dh_cell_accessor.hh:32
FieldSet::set_surface_depth
void set_surface_depth(std::shared_ptr< SurfaceDepth > surface_depth)
Set surface depth object to "d" field.
Definition: field_set.hh:374
FieldFormula::set_mesh
void set_mesh(const Mesh *mesh, bool boundary_domain) override
Definition: field_formula.cc:199
uint
unsigned int uint
Definition: mh_dofhandler.hh:101
TimeStep::use_fparser_
bool use_fparser_
Definition: time_governor.hh:235
FieldAlgorithmBase::Point
Space< spacedim >::Point Point
Definition: field_algo_base.hh:115
FieldFormula::~FieldFormula
virtual ~FieldFormula()
Definition: field_formula.cc:465
n_shape
uint n_shape(std::vector< uint > shape)
Definition: field_formula.cc:310
Armor::Array::n_rows
uint n_rows() const
Definition: armor.hh:715
ElementCacheMap::region_chunk_end
unsigned int region_chunk_end(unsigned int region_patch_idx) const
Return end position of region chunk in FieldValueCache.
Definition: field_value_cache.hh:257
FieldFormula::FieldFormula
FieldFormula(unsigned int n_comp=0)
Definition: field_formula.cc:75
Input::Type::Default
Class Input::Type::Default specifies default value of keys of a Input::Type::Record.
Definition: type_record.hh:61
Input::Type::Record::derive_from
virtual Record & derive_from(Abstract &parent)
Method to derive new Record from an AbstractRecord parent.
Definition: type_record.cc:196
TimeStep::end
double end() const
Definition: time_governor.hh:161
FieldFormula::get_input_type
static const Input::Type::Record & get_input_type()
Implementation.
Definition: field_formula.cc:39
Input::Record
Accessor to the data with type Type::Record.
Definition: accessors.hh:291
ASSERT_PERMANENT
#define ASSERT_PERMANENT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
Definition: asserts.hh:347
FieldAlgoBaseInitData
Helper struct stores data for initizalize descentants of FieldAlgorithmBase.
Definition: field_algo_base.hh:81
Input::Type::Record::allow_auto_conversion
virtual Record & allow_auto_conversion(const string &from_key)
Allows shorter input of the Record providing only value of the from_key given as the parameter.
Definition: type_record.cc:133
TimeStep
Representation of one time step..
Definition: time_governor.hh:123
FieldAlgorithmBase::value_
Value value_
Last value, prevents passing large values (vectors) by value.
Definition: field_algo_base.hh:280
FieldFormula::set_time
bool set_time(const TimeStep &time) override
Definition: field_formula.cc:104
Input::Type::Default::obligatory
static Default obligatory()
The factory function to make an empty default value which is obligatory.
Definition: type_record.hh:110
ASSERT_EQ
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
Definition: asserts.hh:332
FieldFormula::init_from_input
virtual void init_from_input(const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data)
Definition: field_formula.cc:94
Input::Type::Record::declare_key
Record & declare_key(const string &key, std::shared_ptr< TypeBase > type, const Default &default_value, const string &description, TypeBase::attribute_map key_attributes=TypeBase::attribute_map())
Declares a new key of the Record.
Definition: type_record.cc:503
FieldSet
Container for various descendants of FieldCommonBase.
Definition: field_set.hh:159
FieldFormula::cache_reinit
void cache_reinit(const ElementCacheMap &cache_map) override
Definition: field_formula.cc:416
Armor::Array::n_cols
uint n_cols() const
Definition: armor.hh:720
Armor::Array::set
ArrayMatSet set(uint index)
Definition: armor.hh:838
Input::Type::Record::close
Record & close() const
Close the Record for further declarations of keys.
Definition: type_record.cc:304
Armor::Array::size
unsigned int size() const
Definition: armor.hh:728
Input::Type
Definition: balance.hh:41
Input::Type::Record
Record type proxy class.
Definition: type_record.hh:182
Value
@ Value
Definition: finite_element.hh:43
input_type.hh
ElementCacheMap::region_chunk_begin
unsigned int region_chunk_begin(unsigned int region_patch_idx) const
Return begin position of region chunk in FieldValueCache.
Definition: field_value_cache.hh:251
Mesh
Definition: mesh.h:359
field_formula.hh
Input::Type::Record::copy_keys
Record & copy_keys(const Record &other)
Copy keys from other record.
Definition: type_record.cc:216
FieldFormula::parser_matrix_
std::vector< std::vector< FunctionParser > > parser_matrix_
Definition: field_formula.hh:150
FieldFormula::set_dependency
std::vector< const FieldCommon * > set_dependency(FieldSet &field_set) override
Definition: field_formula.cc:318
FieldAlgorithmBase
Definition: field_algo_base.hh:112
Input::Type::String
Class for declaration of the input data that are in string format.
Definition: type_base.hh:582
Input::Array
Accessor to input data conforming to declared Array.
Definition: accessors.hh:566
WarningOut
#define WarningOut()
Macro defining 'warning' record of log.
Definition: logger.hh:278
INSTANCE_ALL
#define INSTANCE_ALL(field)
Definition: field_instances.hh:43
field_instances.hh
Armor::Array< double >
std::list
Definition: doxy_dummy_defs.hh:9
FieldFormula::value_list
virtual void value_list(const Armor::array &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list)
Definition: field_formula.cc:228
DebugOut
#define DebugOut()
Macro defining 'debug' record of log.
Definition: logger.hh:284
Input::Type::Default::optional
static Default optional()
The factory function to make an empty default value which is optional.
Definition: type_record.hh:124
FieldFormula::value
virtual const Value::return_type & value(const Point &p, const ElementAccessor< spacedim > &elm)
Definition: field_formula.cc:212
FieldSet::field
FieldCommon * field(const std::string &field_name) const
Definition: field_set.cc:168
FieldFormula
Definition: field_formula.hh:63
FMT_UNUSED
#define FMT_UNUSED
Definition: posix.h:75