Flow123d
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_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 FieldBase<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  virtual bool set_time(double time);
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
86 
87  /// Raw buffer of n_entities rows each containing Value::size() doubles.
88  double *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  /// 3D (tetrahedron) element, used for computing intersection
104 
105  /// 2D (triangle) element, used for computing intersection
107 
108  /// 1D (abscissa) element, used for computing intersection
110 
111  /// 0D (point) element, used for computing intersection
113 };
114 
115 
116 
117 #endif /* FUNCTION_INTERPOLATED_P0_HH_ */