Flow123d  last_with_con_2.0.0-4-g42e6930
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 "mesh/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);
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  /// mesh, which is interpolated
72 
73  /// mesh reader file
75 
76  /// Raw buffer of n_entities rows each containing Value::size() doubles.
77  std::shared_ptr< std::vector<typename Value::element_type> > data_;
78 
79  /// vector stored suspect elements in calculating the intersection
81 
82  /// field name read from input
83  std::string field_name_;
84 
85  /// tree of mesh elements
87 
88  /// stored index to last computed element
89  unsigned int computed_elm_idx_ = numeric_limits<unsigned int>::max();
90 
91  /// stored flag if last computed element is boundary
92  unsigned int computed_elm_boundary_;
93 
94  /// 3D (tetrahedron) element, used for computing intersection
96 
97  /// 2D (triangle) element, used for computing intersection
99 
100  /// 1D (abscissa) element, used for computing intersection
102 
103  /// 0D (point) element, used for computing intersection
105 
106 private:
107  /// Registrar of class to factory
108  static const int registrar;
109 
110 };
111 
112 
113 
114 #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 Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm)
Definition: mesh.h:95
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:277
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:48
std::vector< unsigned int > searched_elements_
vector stored suspect elements in calculating the intersection
virtual void init_from_input(const Input::Record &rec)
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:171
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