Flow123d  release_2.2.0-22-g936454a
field_interpolated_p0.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_interpolated_p0.hh
15  * @brief
16  */
17 
18 #ifndef FIELD_INTERPOLATED_P0_HH_
19 #define FIELD_INTERPOLATED_P0_HH_
20 
21 #include "field_algo_base.hh"
22 #include "mesh/mesh.h"
23 #include "mesh/mesh_types.hh"
24 #include "system/system.hh"
25 #include "io/msh_gmshreader.h"
26 #include "mesh/bih_tree.hh"
28 #include "input/factory.hh"
29 
30 
31 template <int spacedim, class Value>
32 class FieldInterpolatedP0: public FieldAlgorithmBase<spacedim, Value> {
33 public:
34 
37 
38  /**
39  * Constructor
40  */
41  FieldInterpolatedP0(unsigned int n_comp=0);
42 
43  /**
44  * Declare Input type.
45  */
46  static const Input::Type::Record & get_input_type();
47 
48  /**
49  * Initialization from the input interface.
50  */
51  virtual void init_from_input(const Input::Record &rec, const struct FieldAlgoBaseInitData& init_data);
52 
53  /**
54  * Update time and possibly update data from GMSH file.
55  */
56  bool set_time(const TimeStep &time) override;
57 
58  /**
59  * Returns one value in one given point. ResultType can be used to avoid some costly calculation if the result is trivial.
60  */
61  virtual typename Value::return_type const &value(const Point &p, const ElementAccessor<spacedim> &elm);
62 
63  /**
64  * Returns std::vector of scalar values in several points at once.
65  */
66  virtual void value_list(const std::vector< Point > &point_list, const ElementAccessor<spacedim> &elm,
68 
69 protected:
70  /// Multiply @p data_ with @p unit_conversion_coefficient_
71  void scale_data();
72 
73  /// mesh, which is interpolated
75 
76  /// mesh reader file
78 
79  /// Raw buffer of n_entities rows each containing Value::size() doubles.
80  std::shared_ptr< std::vector<typename Value::element_type> > data_;
81 
82  /// vector stored suspect elements in calculating the intersection
84 
85  /// field name read from input
86  std::string field_name_;
87 
88  /// tree of mesh elements
90 
91  /// stored index to last computed element
92  unsigned int computed_elm_idx_ = numeric_limits<unsigned int>::max();
93 
94  /// stored flag if last computed element is boundary
95  unsigned int computed_elm_boundary_;
96 
97  /// 3D (tetrahedron) element, used for computing intersection
99 
100  /// 2D (triangle) element, used for computing intersection
102 
103  /// 1D (abscissa) element, used for computing intersection
105 
106  /// 0D (point) element, used for computing intersection
108 
109 private:
110  /// Registrar of class to factory
111  static const int registrar;
112 
113 };
114 
115 
116 
117 #endif /* FUNCTION_INTERPOLATED_P0_HH_ */
unsigned int computed_elm_boundary_
stored flag if last computed element is boundary
bool set_time(const TimeStep &time) override
FieldAlgorithmBase< spacedim, Value >::Point Point
FilePath reader_file_
mesh reader file
virtual void init_from_input(const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data)
virtual Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm)
Definition: mesh.h:97
Helper struct stores data for initizalize descentants of FieldAlgorithmBase.
unsigned int computed_elm_idx_
stored index to last computed element
TAbscissa abscissa_
1D (abscissa) element, used for computing intersection
TPoint point_
0D (point) element, used for computing intersection
static const int registrar
Registrar of class to factory.
virtual void value_list(const std::vector< Point > &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list)
Mesh * source_mesh_
mesh, which is interpolated
Definition: point.h:27
Accessor to the data with type Type::Record.
Definition: accessors.hh:292
FieldAlgorithmBase< spacedim, Value > FactoryBaseType
FieldInterpolatedP0(unsigned int n_comp=0)
Class for O(log N) lookup for intersections with a set of bounding boxes.
Definition: bih_tree.hh:36
Space< spacedim >::Point Point
BIHTree * bih_tree_
tree of mesh elements
static const Input::Type::Record & get_input_type()
Dedicated class for storing path to input and output files.
Definition: file_path.hh:54
std::vector< unsigned int > searched_elements_
vector stored suspect elements in calculating the intersection
void scale_data()
Multiply data_ with unit_conversion_coefficient_.
TTriangle triangle_
2D (triangle) element, used for computing intersection
TTetrahedron tetrahedron_
3D (tetrahedron) element, used for computing intersection
Record type proxy class.
Definition: type_record.hh:182
std::string field_name_
field name read from input
std::shared_ptr< std::vector< typename Value::element_type > > data_
Raw buffer of n_entities rows each containing Value::size() doubles.
Representation of one time step..
unsigned int n_comp() const