Flow123d  release_3.0.0-506-g34af125
field_fe.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_fe.cc
15  * @brief
16  */
17 
18 
19 #include <limits>
20 
21 #include "fields/field_fe.hh"
22 #include "fields/vec_seq_double.hh"
23 #include "fields/field_instances.hh" // for instantiation macros
25 #include "input/input_type.hh"
26 #include "fem/fe_p.hh"
27 #include "fem/fe_system.hh"
28 #include "io/reader_cache.hh"
29 #include "io/msh_gmshreader.h"
30 #include "mesh/accessors.hh"
31 #include "mesh/range_wrapper.hh"
32 
33 
34 
35 
36 /// Implementation.
37 
38 namespace it = Input::Type;
39 
40 
41 
42 
44 
45 
46 template <int spacedim, class Value>
47 const Input::Type::Record & FieldFE<spacedim, Value>::get_input_type()
48 {
49  return it::Record("FieldFE", FieldAlgorithmBase<spacedim,Value>::template_name()+" Field given by finite element approximation.")
53  "GMSH mesh with data. Can be different from actual computational mesh.")
55  "Section where to find the field, some sections are specific to file format \n"
56  "point_data/node_data, cell_data/element_data, -/element_node_data, native/-.\n"
57  "If not given by user we try to find the field in all sections, but report error \n"
58  "if it is found in more the one section.")
60  "The values of the Field are read from the ```$ElementData``` section with field name given by this key.")
61  .declare_key("default_value", IT::Double(), IT::Default::optional(),
62  "Allow set default value of elements that have not listed values in mesh data file.")
63  .declare_key("time_unit", IT::String(), IT::Default::read_time("Common unit of TimeGovernor."),
64  "Definition of unit of all times defined in mesh data file.")
65  .declare_key("read_time_shift", TimeGovernor::get_input_time_type(), IT::Default("0.0"),
66  "Allow set time shift of field data read from the mesh data file. For time 't', field descriptor with time 'T', "
67  "time shift 'S' and if 't > T', we read time frame 't + S'.")
68  .close();
69 }
70 
71 template <int spacedim, class Value>
73 {
74  return it::Selection("FE_discretization",
75  "Specify the section in mesh input file where field data is listed.\nSome sections are specific to file format.")
76  .add_value(OutputTime::DiscreteSpace::NODE_DATA, "node_data", "point_data (VTK) / node_data (GMSH)")
77  .add_value(OutputTime::DiscreteSpace::ELEM_DATA, "element_data", "cell_data (VTK) / element_data (GMSH)")
78  .add_value(OutputTime::DiscreteSpace::CORNER_DATA, "element_node_data", "element_node_data (only for GMSH)")
79  .add_value(OutputTime::DiscreteSpace::NATIVE_DATA, "native_data", "native_data (only for VTK)")
80  .close();
81 }
82 
83 template <int spacedim, class Value>
85  Input::register_class< FieldFE<spacedim, Value>, unsigned int >("FieldFE") +
87 
88 
89 
90 template <int spacedim, class Value>
91 FieldFE<spacedim, Value>::FieldFE( unsigned int n_comp)
92 : FieldAlgorithmBase<spacedim, Value>(n_comp),
93  data_vec_(nullptr),
94  field_name_(""),
95  has_compatible_mesh_(false)
96 {
97  this->is_constant_in_space_ = false;
98 }
99 
100 
101 template <int spacedim, class Value>
102 void FieldFE<spacedim, Value>::set_fe_data(std::shared_ptr<DOFHandlerMultiDim> dh,
103  MappingP1<1,3> *map1,
104  MappingP1<2,3> *map2,
105  MappingP1<3,3> *map3,
106  VectorSeqDouble *data)
107 {
108  dh_ = dh;
109  data_vec_ = data;
110  reinit_fe_data(map1, map2, map3);
111 }
112 
113 
114 
115 template <int spacedim, class Value>
116 void FieldFE<spacedim, Value>::set_native_dh(std::shared_ptr<DOFHandlerMultiDim> dh)
117 {
118  dh_ = dh;
119  reinit_fe_data(nullptr, nullptr, nullptr);
120 }
121 
122 
123 
124 template <int spacedim, class Value>
126  MappingP1<2,3> *map2,
127  MappingP1<3,3> *map3)
128 {
129  //ASSERT_EQ(dh_->n_global_dofs(), data_vec_->size());
130 
131  unsigned int ndofs = dh_->max_elem_dofs();
132  dof_indices_.resize(ndofs);
133 
134  // initialization data of value handlers
135  FEValueInitData init_data;
136  init_data.dh = dh_;
137  init_data.data_vec = data_vec_;
138  init_data.ndofs = ndofs;
139  init_data.n_comp = this->n_comp();
140 
141  // initialize value handler objects
142  value_handler0_.initialize(init_data);
143  value_handler1_.initialize(init_data, map1);
144  value_handler2_.initialize(init_data, map2);
145  value_handler3_.initialize(init_data, map3);
146 
147  // set discretization
148  discretization_ = OutputTime::DiscreteSpace::UNDEFINED;
149 }
150 
151 
152 
153 /**
154  * Returns one value in one given point. ResultType can be used to avoid some costly calculation if the result is trivial.
155  */
156 template <int spacedim, class Value>
157 typename Value::return_type const & FieldFE<spacedim, Value>::value(const Point &p, const ElementAccessor<spacedim> &elm)
158 {
159  switch (elm.dim()) {
160  case 0:
161  return value_handler0_.value(p, elm);
162  case 1:
163  return value_handler1_.value(p, elm);
164  case 2:
165  return value_handler2_.value(p, elm);
166  case 3:
167  return value_handler3_.value(p, elm);
168  default:
169  ASSERT(false).error("Invalid element dimension!");
170  }
171 
172  return this->r_value_;
173 }
174 
175 
176 
177 /**
178  * Returns std::vector of scalar values in several points at once.
179  */
180 template <int spacedim, class Value>
183 {
184  ASSERT_EQ( point_list.size(), value_list.size() ).error();
185 
186  switch (elm.dim()) {
187  case 0:
188  value_handler0_.value_list(point_list, elm, value_list);
189  break;
190  case 1:
191  value_handler1_.value_list(point_list, elm, value_list);
192  break;
193  case 2:
194  value_handler2_.value_list(point_list, elm, value_list);
195  break;
196  case 3:
197  value_handler3_.value_list(point_list, elm, value_list);
198  break;
199  default:
200  ASSERT(false).error("Invalid element dimension!");
201  }
202 }
203 
204 
205 
206 template <int spacedim, class Value>
208  this->init_unit_conversion_coefficient(rec, init_data);
209  this->in_rec_ = rec;
210  flags_ = init_data.flags_;
211 
212 
213  // read data from input record
214  reader_file_ = FilePath( rec.val<FilePath>("mesh_data_file") );
215  field_name_ = rec.val<std::string>("field_name");
216  if (! rec.opt_val<OutputTime::DiscreteSpace>("input_discretization", discretization_) ) {
217  discretization_ = OutputTime::DiscreteSpace::UNDEFINED;
218  }
219  if (! rec.opt_val("default_value", default_value_) ) {
220  default_value_ = numeric_limits<double>::signaling_NaN();
221  }
222 }
223 
224 
225 
226 template <int spacedim, class Value>
227 void FieldFE<spacedim, Value>::set_mesh(const Mesh *mesh, bool boundary_domain) {
228  // Mesh can be set only for field initialized from input.
230  ASSERT(field_name_ != "").error("Uninitialized FieldFE, did you call init_from_input()?\n");
231  this->boundary_domain_ = boundary_domain;
232  this->make_dof_handler(mesh);
233  this->has_compatible_mesh_ = ReaderCache::check_compatible_mesh(reader_file_, const_cast<Mesh &>(*mesh) );
234  }
235 }
236 
237 
238 
239 template <int spacedim, class Value>
241  // temporary solution - these objects will be set through FieldCommon
242  switch (this->value_.n_rows() * this->value_.n_cols()) { // by number of components
243  case 1: { // scalar
244  fe0_ = new FE_P_disc<0>(0);
245  fe1_ = new FE_P_disc<1>(0);
246  fe2_ = new FE_P_disc<2>(0);
247  fe3_ = new FE_P_disc<3>(0);
248  break;
249  }
250  case 3: { // vector
251  std::shared_ptr< FiniteElement<0> > fe0_ptr = std::make_shared< FE_P_disc<0> >(0);
252  std::shared_ptr< FiniteElement<1> > fe1_ptr = std::make_shared< FE_P_disc<1> >(0);
253  std::shared_ptr< FiniteElement<2> > fe2_ptr = std::make_shared< FE_P_disc<2> >(0);
254  std::shared_ptr< FiniteElement<3> > fe3_ptr = std::make_shared< FE_P_disc<3> >(0);
255  fe0_ = new FESystem<0>(fe0_ptr, FEType::FEVector, 3);
256  fe1_ = new FESystem<1>(fe1_ptr, FEType::FEVector, 3);
257  fe2_ = new FESystem<2>(fe2_ptr, FEType::FEVector, 3);
258  fe3_ = new FESystem<3>(fe3_ptr, FEType::FEVector, 3);
259  break;
260  }
261  case 9: { // tensor
262  std::shared_ptr< FiniteElement<0> > fe0_ptr = std::make_shared< FE_P_disc<0> >(0);
263  std::shared_ptr< FiniteElement<1> > fe1_ptr = std::make_shared< FE_P_disc<1> >(0);
264  std::shared_ptr< FiniteElement<2> > fe2_ptr = std::make_shared< FE_P_disc<2> >(0);
265  std::shared_ptr< FiniteElement<3> > fe3_ptr = std::make_shared< FE_P_disc<3> >(0);
266  fe0_ = new FESystem<0>(fe0_ptr, FEType::FETensor, 9);
267  fe1_ = new FESystem<1>(fe1_ptr, FEType::FETensor, 9);
268  fe2_ = new FESystem<2>(fe2_ptr, FEType::FETensor, 9);
269  fe3_ = new FESystem<3>(fe3_ptr, FEType::FETensor, 9);
270  break;
271  }
272  default:
273  ASSERT(false).error("Should not happen!\n");
274  }
275 
276  dh_ = std::make_shared<DOFHandlerMultiDim>( const_cast<Mesh &>(*mesh) );
277  std::shared_ptr<DiscreteSpace> ds = std::make_shared<EqualOrderDiscreteSpace>( &const_cast<Mesh &>(*mesh), fe0_, fe1_, fe2_, fe3_);
278  dh_->distribute_dofs(ds, true);
279  unsigned int ndofs = dh_->max_elem_dofs();
280  dof_indices_.resize(ndofs);
281 
282  // allocate data_vec_
283  unsigned int data_size = dh_->n_global_dofs();
284  data_vec_ = new VectorSeqDouble();
285  data_vec_->resize(data_size);
286 
287  // initialization data of value handlers
288  FEValueInitData init_data;
289  init_data.dh = dh_;
290  init_data.data_vec = data_vec_;
291  init_data.ndofs = ndofs;
292  init_data.n_comp = this->n_comp();
293 
294  // initialize value handler objects
295  value_handler0_.initialize(init_data);
296  value_handler1_.initialize(init_data);
297  value_handler2_.initialize(init_data);
298  value_handler3_.initialize(init_data);
299 }
300 
301 
302 
303 template <int spacedim, class Value>
305  // Time can be set only for field initialized from input.
307  ASSERT(field_name_ != "").error("Uninitialized FieldFE, did you call init_from_input()?\n");
308  ASSERT_PTR(dh_)(field_name_).error("Null target mesh pointer of finite element field, did you call set_mesh()?\n");
309  if ( reader_file_ == FilePath() ) return false;
310 
311  unsigned int n_components = this->value_.n_rows() * this->value_.n_cols();
312  double time_unit_coef = time.read_coef(in_rec_.find<string>("time_unit"));
313  double time_shift = time.read_time( in_rec_.find<Input::Tuple>("read_time_shift") );
314  double read_time = (time.end()+time_shift) / time_unit_coef;
315  BaseMeshReader::HeaderQuery header_query(field_name_, read_time, this->discretization_, dh_->hash());
316  ReaderCache::get_reader(reader_file_)->find_header(header_query);
317  // TODO: use default and check NaN values in data_vec
318 
319  unsigned int n_entities;
320  bool is_native = (header_query.discretization == OutputTime::DiscreteSpace::NATIVE_DATA);
321  if (is_native || this->has_compatible_mesh_) {
322  n_entities = dh_->mesh()->n_elements();
323  } else {
324  n_entities = ReaderCache::get_mesh(reader_file_)->n_elements();
325  }
326  auto data_vec = ReaderCache::get_reader(reader_file_)->template get_element_data<double>(n_entities, n_components,
327  this->boundary_domain_, this->component_idx_);
328  CheckResult checked_data = ReaderCache::get_reader(reader_file_)->scale_and_check_limits(field_name_,
330 
331 
332  if (checked_data == CheckResult::not_a_number) {
333  THROW( ExcUndefElementValue() << EI_Field(field_name_) );
334  }
335 
336  if (is_native || this->has_compatible_mesh_) {
337  this->calculate_native_values(data_vec);
338  } else {
339  this->interpolate(data_vec);
340  }
341 
342  return true;
343  } else return false;
344 
345 }
346 
347 
348 template <int spacedim, class Value>
350 {
351  ASSERT(!this->boundary_domain_)(field_name_).error("Interpolation of boundary FieldFE is not supported yet.\n");
352  std::shared_ptr<Mesh> source_mesh = ReaderCache::get_mesh(reader_file_);
353  std::vector<double> sum_val(4);
354  std::vector<unsigned int> elem_count(4);
355  std::vector<unsigned int> searched_elements; // stored suspect elements in calculating the intersection
356 
357  for (auto ele : dh_->mesh()->elements_range()) {
358  searched_elements.clear();
359  source_mesh->get_bih_tree().find_point(ele.centre(), searched_elements);
360  std::fill(sum_val.begin(), sum_val.end(), 0.0);
361  std::fill(elem_count.begin(), elem_count.end(), 0);
362  for (std::vector<unsigned int>::iterator it = searched_elements.begin(); it!=searched_elements.end(); it++) {
363  ElementAccessor<3> elm = source_mesh->element_accessor(*it);
364  bool contains=false;
365  switch (elm->dim()) {
366  case 0:
367  contains = arma::norm(elm.node(0)->point()-ele.centre(), 2) < 4*std::numeric_limits<double>::epsilon();
368  break;
369  case 1:
370  contains = value_handler1_.get_mapping()->contains_point(ele.centre(), elm);
371  break;
372  case 2:
373  contains = value_handler2_.get_mapping()->contains_point(ele.centre(), elm);
374  break;
375  case 3:
376  contains = value_handler3_.get_mapping()->contains_point(ele.centre(), elm);
377  break;
378  default:
379  ASSERT(false).error("Invalid element dimension!");
380  }
381  if (contains) {
382  // projection point in element
383  sum_val[elm->dim()] += (*data_vec)[*it];
384  ++elem_count[elm->dim()];
385  }
386  }
387  unsigned int dim = ele->dim();
388  double elem_value = 0.0;
389  do {
390  if (elem_count[dim] > 0) {
391  elem_value = sum_val[dim] / elem_count[dim];
392  break;
393  }
394  ++dim;
395  } while (dim<4);
396 
397  dh_->get_dof_indices( ele, dof_indices_);
399  (*data_vec_)[dof_indices_[0]] = elem_value * this->unit_conversion_coefficient_;
400  }
401 }
402 
403 
404 template <int spacedim, class Value>
406 {
407  // Same algorithm as in output of Node_data. Possibly code reuse.
408  unsigned int dof_size, data_vec_i;
409  std::vector<unsigned int> count_vector(data_vec_->size(), 0);
410  data_vec_->fill(0.0);
412 
413  // iterate through elements, assembly global vector and count number of writes
414  for (auto ele : dh_->mesh()->elements_range()) {
415  dof_size = dh_->get_dof_indices( ele, dof_indices_ );
416  data_vec_i = ele.idx() * dof_indices_.size();
417  for (unsigned int i=0; i<dof_size; ++i, ++data_vec_i) {
418  (*data_vector)[ dof_indices_[i] ] += (*data_cache)[data_vec_i];
419  ++count_vector[ dof_indices_[i] ];
420  }
421  }
422 
423  // compute averages of values
424  for (unsigned int i=0; i<data_vec_->size(); ++i) {
425  if (count_vector[i]>0) (*data_vector)[i] /= count_vector[i];
426  }
427 }
428 
429 
430 template <int spacedim, class Value>
432  ASSERT_EQ(output_data_cache.n_values() * output_data_cache.n_elem(), dh_->n_global_dofs()).error();
433  ASSERT_EQ(output_data_cache.n_elem(), dof_indices_.size()).error();
434  double loc_values[output_data_cache.n_elem()];
435  unsigned int i, dof_filled_size;
436 
438  for (auto ele : dh_->mesh()->elements_range()) {
439  dof_filled_size = dh_->get_dof_indices( ele, dof_indices_);
440  for (i=0; i<dof_filled_size; ++i) loc_values[i] = (*data_vec)[ dof_indices_[0] ];
441  for ( ; i<output_data_cache.n_elem(); ++i) loc_values[i] = numeric_limits<double>::signaling_NaN();
442  output_data_cache.store_value( ele.idx(), loc_values );
443  }
444 
445  output_data_cache.set_dof_handler_hash( dh_->hash() );
446 }
447 
448 
449 
450 template <int spacedim, class Value>
451 inline unsigned int FieldFE<spacedim, Value>::data_size() const {
452  return data_vec_->size();
453 }
454 
455 
456 
457 template <int spacedim, class Value>
459 {}
460 
461 
462 // Instantiations of FieldFE
virtual ~FieldFE()
Destructor.
Definition: field_fe.cc:458
void init_unit_conversion_coefficient(const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data)
Init value of unit_conversion_coefficient_ from input.
virtual void value_list(const std::vector< Point > &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list)
Definition: field_fe.cc:181
void set_dof_handler_hash(std::size_t hash)
FEValueHandler< 0, spacedim, Value > value_handler0_
Value handler that allows get value of 0D elements.
Definition: field_fe.hh:155
std::shared_ptr< std::vector< T > > ComponentDataPtr
double read_coef(Input::Iterator< std::string > unit_it) const
void interpolate(ElementDataCache< double >::ComponentDataPtr data_vec)
Interpolate data over all elements of target mesh.
Definition: field_fe.cc:349
VectorSeqDouble * data_vec_
Store data of Field.
Definition: field_fe.hh:150
Some value(s) is set to NaN.
unsigned int component_idx_
Specify if the field is part of a MultiField and which component it is.
Class Input::Type::Default specifies default value of keys of a Input::Type::Record.
Definition: type_record.hh:61
void initialize(FEValueInitData init_data, MappingP1< elemdim, 3 > *map=nullptr)
Initialize data members.
void fill(double value)
Fill all values of data vector with given value.
std::string field_name_
field name read from input
Definition: field_fe.hh:180
void fill_data_to_cache(ElementDataCache< double > &output_data_cache)
Definition: field_fe.cc:431
Abstract linear system class.
Definition: balance.hh:35
FieldFlag::Flags flags_
FEValueHandler< 2, spacedim, Value > value_handler2_
Value handler that allows get value of 2D elements.
Definition: field_fe.hh:159
void store_value(unsigned int idx, const T *value)
static Default obligatory()
The factory function to make an empty default value which is obligatory.
Definition: type_record.hh:110
FilePath reader_file_
mesh reader file
Definition: field_fe.hh:177
std::shared_ptr< std::vector< double > > VectorSeq
#define INSTANCE_ALL(field)
Definition: mesh.h:80
Iterator< Ret > find(const string &key) const
void initialize(FEValueInitData init_data)
Initialize data members.
Helper struct stores data for initizalize descentants of FieldAlgorithmBase.
Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm)
Returns one value in one given point.
Class FESystem for compound finite elements.
void set_mesh(const Mesh *mesh, bool boundary_domain) override
Definition: field_fe.cc:227
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
Definition: asserts.hh:346
double default_value_
Default value of element if not set in mesh data file.
Definition: field_fe.hh:189
FEValueHandler< 3, spacedim, Value > value_handler3_
Value handler that allows get value of 3D elements.
Definition: field_fe.hh:161
bool set_time(const TimeStep &time) override
Definition: field_fe.cc:304
FiniteElement< 3 > * fe3_
Same as previous, but represents 3D element.
Definition: field_fe.hh:174
Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm)
Returns one value in one given point.
Value::return_type r_value_
Record & close() const
Close the Record for further declarations of keys.
Definition: type_record.cc:303
unsigned int size()
Getter for shared pointer of output data.
unsigned int data_size() const
Definition: field_fe.cc:451
constexpr bool match(Mask mask) const
Definition: flag_array.hh:163
double unit_conversion_coefficient_
Coeficient of conversion of user-defined unit.
virtual Record & derive_from(Abstract &parent)
Method to derive new Record from an AbstractRecord parent.
Definition: type_record.cc:195
unsigned int dim() const
Definition: elements.h:124
static Default optional()
The factory function to make an empty default value which is optional.
Definition: type_record.hh:124
bool boundary_domain_
Is set in set_mesh method. Value true means, that we accept only boundary element accessors in the va...
Definition: field_fe.hh:195
void set_native_dh(std::shared_ptr< DOFHandlerMultiDim > dh) override
Definition: field_fe.cc:116
friend class VectorSeqDouble
Definition: field_fe.hh:203
bool opt_val(const string &key, Ret &value) const
OutputTime::DiscreteSpace discretization_
Specify section where to find the field data in input mesh file.
Definition: field_fe.hh:183
std::shared_ptr< DOFHandlerMultiDim > dh_
DOF handler object.
Definition: field_fe.hh:148
Class for declaration of the input data that are floating point numbers.
Definition: type_base.hh:541
static const Input::Type::Tuple & get_input_time_type(double lower_bound=-std::numeric_limits< double >::max(), double upper_bound=std::numeric_limits< double >::max())
void value_list(const std::vector< Point > &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list)
Returns std::vector of scalar values in several points at once.
Compound finite element on dim dimensional simplex.
Definition: fe_system.hh:99
VectorSeqDouble * data_vec
Store data of Field.
Definitions of basic Lagrangean finite elements with polynomial shape functions.
static FileName input()
The factory function for declaring type FileName for input files.
Definition: type_base.cc:526
Accessor to the data with type Type::Record.
Definition: accessors.hh:292
const Ret val(const string &key) const
void resize(unsigned int size)
Create shared pointer and PETSC vector with given size.
Selection & add_value(const int value, const std::string &key, const std::string &description="", TypeBase::attribute_map attributes=TypeBase::attribute_map())
Adds one new value with name given by key to the Selection.
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:501
virtual Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm)
Definition: field_fe.cc:157
static bool check_compatible_mesh(const FilePath &file_path, Mesh &mesh)
Definition: reader_cache.cc:73
double end() const
unsigned int ndofs
number of dofs
Space< spacedim >::Point Point
void reinit_fe_data(MappingP1< 1, 3 > *map1, MappingP1< 2, 3 > *map2, MappingP1< 3, 3 > *map3)
Ensure data setting of methods set_fe_data and set_native_dh.
Definition: field_fe.cc:125
CheckResult
Return type of method that checked data stored in ElementDataCache (NaN values, limits) ...
std::shared_ptr< DOFHandlerMultiDim > dh
DOF handler object.
bool has_compatible_mesh_
Flag that determines if source mesh and target mesh are compatible.
Definition: field_fe.hh:198
double read_time(Input::Iterator< Input::Tuple > time_it, double default_time=std::numeric_limits< double >::quiet_NaN()) const
void set_fe_data(std::shared_ptr< DOFHandlerMultiDim > dh, MappingP1< 1, 3 > *map1, MappingP1< 2, 3 > *map2, MappingP1< 3, 3 > *map3, VectorSeqDouble *data)
Definition: field_fe.cc:102
FEValueHandler< 1, spacedim, Value > value_handler1_
Value handler that allows get value of 1D elements.
Definition: field_fe.hh:157
Record & copy_keys(const Record &other)
Copy keys from other record.
Definition: type_record.cc:215
Dedicated class for storing path to input and output files.
Definition: file_path.hh:54
MappingP1< elemdim, 3 > * get_mapping()
Return mapping object.
FiniteElement< 1 > * fe1_
Same as previous, but represents 1D element.
Definition: field_fe.hh:170
static const Input::Type::Selection & get_disc_selection_input_type()
Definition: field_fe.cc:72
static Default read_time(const std::string &description)
The factory function to make an default value that will be specified at the time when a key will be r...
Definition: type_record.hh:97
FiniteElement< 2 > * fe2_
Same as previous, but represents 2D element.
Definition: field_fe.hh:172
bool is_constant_in_space_
Flag detects that field is only dependent on time.
Value value_
Last value, prevents passing large values (vectors) by value.
Input::Record in_rec_
Accessor to Input::Record.
Definition: field_fe.hh:192
#define ASSERT_PTR(ptr)
Definition of assert macro checking non-null pointer (PTR)
Definition: asserts.hh:335
const Selection & close() const
Close the Selection, no more values can be added.
FieldFE(unsigned int n_comp=0)
Definition: field_fe.cc:91
void value_list(const std::vector< Point > &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list)
Returns std::vector of scalar values in several points at once.
std::vector< LongIdx > dof_indices_
Array of indexes to data_vec_, used for get/set values.
Definition: field_fe.hh:152
FiniteElement< 0 > * fe0_
Definition: field_fe.hh:168
virtual void init_from_input(const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data)
Definition: field_fe.cc:207
static std::shared_ptr< Mesh > get_mesh(const FilePath &file_path)
Definition: reader_cache.cc:40
VectorSeq get_data_ptr()
Getter for shared pointer of output data.
Record type proxy class.
Definition: type_record.hh:182
Accessor to the data with type Type::Tuple.
Definition: accessors.hh:412
static constexpr Mask equation_input
The field is data parameter of the owning equation. (default on)
Definition: field_flag.hh:33
unsigned int dim() const
Definition: accessors.hh:87
bool contains_point(arma::vec point, ElementAccessor< 3 > elm)
Test if element contains given point.
Definition: mapping_p1.cc:302
static std::shared_ptr< BaseMeshReader > get_reader(const FilePath &file_path)
Definition: reader_cache.cc:36
unsigned int n_comp
number of components
void calculate_native_values(ElementDataCache< double >::ComponentDataPtr data_cache)
Calculate native data over all elements of target mesh.
Definition: field_fe.cc:405
FieldFlag::Flags flags_
Field flags.
Definition: field_fe.hh:186
arma::vec3 & point()
Definition: nodes.hh:67
Initialization structure of FEValueHandler class.
Class for declaration of the input data that are in string format.
Definition: type_base.hh:589
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
Definition: exceptions.hh:53
Representation of one time step..
Template for classes storing finite set of named values.
void make_dof_handler(const Mesh *mesh)
Create DofHandler object.
Definition: field_fe.cc:240
Implementation of range helper class.
#define FLOW123D_FORCE_LINK_IN_CHILD(x)
Definition: global_defs.h:180
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual)
Definition: asserts.hh:327
static constexpr Mask declare_input
The field can be set from input. The key in input field descriptor is declared. (default on) ...
Definition: field_flag.hh:35
Definition: field.hh:56
unsigned int n_comp() const
#define ASSERT_LT_DBG(a, b)
Definition of comparative assert macro (Less Than) only for debug mode.
Definition: asserts.hh:299
const Node * node(unsigned int ni) const
Definition: accessors.hh:145