Flow123d  jenkins-Flow123d-linux-release-multijob-282
field_interpolated_p0.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2007 Technical University of Liberec. All rights reserved.
4  *
5  * Please make a following refer to Flow123d on your project site if you use the program for any purpose,
6  * especially for academic research:
7  * Flow123d, Research Centre: Advanced Remedial Technologies, Technical University of Liberec, Czech Republic
8  *
9  * This program is free software; you can redistribute it and/or modify it under the terms
10  * of the GNU General Public License version 3 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along with this program; if not,
17  * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 021110-1307, USA.
18  *
19  *
20  * $Id: function_interpolated_p0.hh 1567 2012-02-28 13:24:58Z jan.brezina $
21  * $Revision: 1567 $
22  * $LastChangedBy: jan.brezina $
23  * $LastChangedDate: 2012-02-28 14:24:58 +0100 (Tue, 28 Feb 2012) $
24  *
25  *
26  */
27 
28 
29 #ifndef FIELD_INTERPOLATED_P0_HH_
30 #define FIELD_INTERPOLATED_P0_HH_
31 
32 #include "field_algo_base.hh"
33 #include "mesh/mesh.h"
34 #include "mesh/mesh_types.hh"
35 #include "system/system.hh"
36 #include "mesh/msh_gmshreader.h"
37 #include "mesh/bih_tree.hh"
39 
40 
41 template <int spacedim, class Value>
42 class FieldInterpolatedP0: public FieldAlgorithmBase<spacedim, Value> {
43 public:
44 
46 
47  /**
48  * Constructor
49  */
50  FieldInterpolatedP0(unsigned int n_comp=0);
51 
52  /**
53  * Declare Input type.
54  */
56 
57  static Input::Type::Record get_input_type(Input::Type::AbstractRecord &a_type, const typename Value::ElementInputType *eit);
58 
59  /**
60  * Initialization from the input interface.
61  */
62  virtual void init_from_input(const Input::Record &rec);
63 
64  /**
65  * Update time and possibly update data from GMSH file.
66  */
67  bool set_time(const TimeStep &time) override;
68 
69  /**
70  * Returns one value in one given point. ResultType can be used to avoid some costly calculation if the result is trivial.
71  */
72  virtual typename Value::return_type const &value(const Point &p, const ElementAccessor<spacedim> &elm);
73 
74  /**
75  * Returns std::vector of scalar values in several points at once.
76  */
77  virtual void value_list(const std::vector< Point > &point_list, const ElementAccessor<spacedim> &elm,
79 
80 protected:
81  /// mesh, which is interpolated
83 
84  /// mesh reader file
86 
87  /// Raw buffer of n_entities rows each containing Value::size() doubles.
88  std::shared_ptr< std::vector<typename Value::element_type> > data_;
89 
90  /// vector stored suspect elements in calculating the intersection
92 
93  /// field name read from input
94  std::string field_name_;
95 
96  /// tree of mesh elements
98 
99  /// stored index to last computed element
100  unsigned int computed_elm_idx_ = numeric_limits<unsigned int>::max();
101 
102  /// stored flag if last computed element is boundary
104 
105  /// 3D (tetrahedron) element, used for computing intersection
107 
108  /// 2D (triangle) element, used for computing intersection
110 
111  /// 1D (abscissa) element, used for computing intersection
113 
114  /// 0D (point) element, used for computing intersection
116 };
117 
118 
119 
120 #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
static Input::Type::Record get_input_type(Input::Type::AbstractRecord &a_type, const typename Value::ElementInputType *eit)
FilePath reader_file_
mesh reader file
???
static Input::Type::Record input_type
virtual Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm)
Definition: mesh.h:109
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
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:10
Accessor to the data with type Type::Record.
Definition: accessors.hh:327
FieldInterpolatedP0(unsigned int n_comp=0)
Class for declaration of polymorphic Record.
Definition: type_record.hh:487
Class for O(log N) lookup for intersections with a set of bounding boxes.
Definition: bih_tree.hh:46
Space< spacedim >::Point Point
BIHTree * bih_tree_
tree of mesh elements
Dedicated class for storing path to input and output files.
Definition: file_path.hh:32
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:169
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