Flow123d
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
flow123d
src
fields
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
"
38
#include "
mesh/ngh/include/abscissa.h
"
39
#include "
mesh/ngh/include/point.h
"
40
#include "
mesh/ngh/include/triangle.h
"
41
#include "
mesh/ngh/include/tetrahedron.h
"
42
43
44
template
<
int
spacedim,
class
Value>
45
class
FieldInterpolatedP0
:
public
FieldBase
<spacedim, Value> {
46
public
:
47
48
typedef
typename
FieldBase<spacedim, Value>::Point
Point
;
49
50
/**
51
* Constructor
52
*/
53
FieldInterpolatedP0
(
unsigned
int
n_comp
=0);
54
55
56
/**
57
* Declare Input type.
58
*/
59
static
Input::Type::Record
input_type
;
60
61
static
Input::Type::Record
get_input_type
(
Input::Type::AbstractRecord
&a_type,
const
typename
Value::ElementInputType *eit);
62
63
/**
64
* Initialization from the input interface.
65
*/
66
virtual
void
init_from_input
(
const
Input::Record
&rec);
67
68
69
/**
70
* Update time and possibly update data from GMSH file.
71
*/
72
virtual
bool
set_time
(
double
time);
73
74
75
/**
76
* Set sources files of interpolation
77
*
78
* @param mesh_file file contained data of mesh
79
* @param raw_output file contained output
80
*
81
* TODO: use streams instead of filenames (better testing)
82
* TODO: use just one GMSH file for both mesh and data (consistency)
83
*/
84
//void set_source_of_interpolation(const FilePath & mesh_file,
85
// const FilePath & raw_output);
86
87
88
/**
89
* Returns one value in one given point. ResultType can be used to avoid some costly calculation if the result is trivial.
90
*/
91
virtual
typename
Value::return_type
const
&
value
(
const
Point
&p,
const
ElementAccessor<spacedim>
&elm);
92
93
/**
94
* Returns std::vector of scalar values in several points at once.
95
*/
96
virtual
void
value_list
(
const
std::vector< Point >
&point_list,
const
ElementAccessor<spacedim>
&elm,
97
std::vector<typename Value::return_type>
&
value_list
);
98
99
protected
:
100
/// mesh, which is interpolated
101
Mesh
*
source_mesh_
;
102
103
/// mesh reader
104
GmshMeshReader
*
reader_
;
105
106
/// Raw buffer of n_entities rows each containing Value::size() doubles.
107
double
*
data_
;
108
109
/// vector stored suspect elements in calculating the intersection
110
std::vector<unsigned int>
searched_elements_
;
111
112
/// field name read from input
113
std::string
field_name_
;
114
115
/// tree of mesh elements
116
BIHTree
*
bih_tree_
;
117
118
/// stored index to last computed element
119
unsigned
int
computed_elm_idx_
= numeric_limits<unsigned int>::max();
120
121
/// 3D (tetrahedron) element, used for computing intersection
122
TTetrahedron
tetrahedron_
;
123
124
/// 2D (triangle) element, used for computing intersection
125
TTriangle
triangle_
;
126
127
/// 1D (abscissa) element, used for computing intersection
128
TAbscissa
abscissa_
;
129
130
/// 0D (point) element, used for computing intersection
131
TPoint
point_
;
132
133
/**
134
* Read scalar element data with name @p field_name using tokenizer @p tok initialized
135
* over a GMSH file or stream.
136
*
137
* This needs lot of work to be general enough to be outside of this class
138
* TODO:
139
* - we need concept of Fields so that we can fill corresponding vectors
140
* - then we should support scalar as well as vector or even tensor data
141
* - support for time dependent data
142
* - selective reading on submesh (parallelism - subdomains, or boundary data)
143
*
144
*/
145
//void read_element_data_from_gmsh(Tokenizer &tok, const string &field_name);
146
147
148
/**
149
* Calculate values in triangle element
150
*/
151
//void calculate_triangle_value(TTriangle &element, unsigned int idx);
152
/**
153
* Calculate values in abscissa element
154
*/
155
//void calculate_abscissa_value(TAbscissa &element, unsigned int idx);
156
/**
157
* Calculate values in point element
158
*/
159
//void calculate_point_value(TPoint &point, unsigned int idx);
160
161
public
:
162
/**
163
* Create tetrahedron from element
164
*/
165
static
void
create_tetrahedron
(
Element
*ele,
TTetrahedron
&te);
166
167
/**
168
* Create triangle from element
169
*/
170
static
void
create_triangle
(
const
Element
*ele,
TTriangle
&tr);
171
172
/**
173
* Create abscissa from element
174
*/
175
static
void
create_abscissa
(
const
Element
*ele,
TAbscissa
&ab);
176
177
/**
178
* Create point from element
179
*/
180
static
void
create_point
(
const
Element
*ele,
TPoint
&p);
181
};
182
183
184
185
#endif
/* FUNCTION_INTERPOLATED_P0_HH_ */
Generated on Thu Apr 17 2014 01:28:45 for Flow123d by
1.8.4