Plugins
Loading...
Searching...
No Matches
fract_eval.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 Gesellschaft fuer Anlagen- und Reaktorsicherheit gGmbH
3 * SPDX-License-Identifier: EUPL-1.2
4 * SPDX-FileContributor: Dmitry Logashenko
5 * SPDX-FileContributor: Goethe Universität Frankfurt
6 * SPDX-FileType: SOURCE
7 *
8 * This file is part of d3f++.
9 * d3f++ is an extension for UG4. Licensing information and citation requirements of UG4 are provided in LICENSES/UG4-LGPL_2.1
10 */
11
12/*
13 * Evaluation of values of functions at fractures.
14 */
15#ifndef __H__UG__PLUGINS__D3F__FRACT_EVAL__
16#define __H__UG__PLUGINS__D3F__FRACT_EVAL__
17
18#include <vector>
19#include <map>
20#include <ostream>
21#include <sstream>
22
23// ug4 headers
24#include "common/common.h"
27
28namespace ug {
29namespace d3f {
30
35template <typename TGridFunc>
37{
38public:
39
41 typedef typename TGridFunc::domain_type domain_type;
42
44 typedef typename TGridFunc::algebra_type algebra_type;
45
47 typedef TGridFunc grid_func_type;
48
50 static const int dim = domain_type::dim;
51
53 typedef typename domain_type::grid_type grid_type;
54
56 typedef typename domain_type::position_type position_type;
57
59 typedef typename domain_type::position_accessor_type position_accessor_type;
60
63
66
69
72
75
76private:
77
80 {
81 const side_type * face;
82
84
87
88 bool closed;
89
91 (
92 const side_type * the_face,
93 const position_type & the_intersection,
94 number the_fract_val,
95 number the_side_val
96 )
97 : face (the_face), intersection (the_intersection), fract_val (the_fract_val), closed (false)
98 {
99 side_val[0] = the_side_val;
100 }
101
104 {
105 side_val[0] = op.side_val[0]; side_val[1] = op.side_val[1];
106 }
107 };
108
109public:
110
113 (
114 SmartPtr<grid_func_type> spGridFunc,
115 const char * cmp_name,
116 SmartPtr<deg_layer_mngr_type> spDegLayerMngr,
117 const position_type & point_0,
118 const position_type & point_1
119 );
120
121#ifdef UG_FOR_LUA
124 (
125 SmartPtr<grid_func_type> spGridFunc,
126 const char * cmp_name,
127 SmartPtr<deg_layer_mngr_type> spDegLayerMngr,
128 const std::vector<number> & point_0,
129 const std::vector<number> & point_1
130 );
131#endif
132
134 void get_all_values ();
135
137 size_t num_intersections () const {return m_values.size ();}
138
140 position_type position (size_t i) const {return m_values[i].intersection;}
141
143 number fract_value (size_t i) const {return m_values[i].fract_val;}
144
146 number side_value_1 (size_t i) const {return m_values[i].side_val[0];}
147
149 number side_value_2 (size_t i) const {return m_values[i].side_val[1];}
150
152 void write
153 (
154 std::ostream & out,
155 const char * inner_sep,
156 const char * outer_sep
157 ) const;
158
161 (
162 std::ostream & out,
163 const char * inner_sep,
164 const char * outer_sep
165 )
166 {
168 write (out, inner_sep, outer_sep);
169 }
170
172 std::string get_as_string
173 (
174 const char * inner_sep,
175 const char * outer_sep
176 )
177 {
178 std::ostringstream str;
179 get_and_write (str, inner_sep, outer_sep);
180 return str.str ();
181 }
182
183private:
184
186 void init_and_check
187 (
188 const char * cmp_name
189 );
190
192 bool is_intersected
193 (
194 element_type * elem,
195 Grid & grid,
196 position_accessor_type & aaPos,
197 position_type & intersection,
198 size_t & num_fract_co,
199 side_type * & inner_side,
200 size_t inner_side_corners [],
201 size_t ass_co []
202 );
203
205 void get_local_coord
206 (
207 side_type * side,
208 size_t num_co,
209 position_accessor_type & aaPos,
210 position_type & global,
211 MathVector<dim-1> & local
212 );
213
215 void get_co_values
216 (
217 element_type * elem,
218 side_type * side,
219 size_t num_fract_co,
220 size_t inner_side_corners [],
221 size_t ass_co [],
222 MathVector<dim-1> & local,
223 number & inner_val,
224 number & outer_val
225 );
226
228 void append_values
229 (
230 const side_type * side,
231 const position_type & intersection,
232 number inner_val,
233 number outer_val
234 );
235
237 void check_values ();
238
239private:
240
242 size_t m_fct;
247
248 std::vector<t_fract_pnt_data> m_values;
249
250};
251
252} // namespace d3f
253} // end namespace ug
254
255#include "fract_eval_impl.h"
256
257#endif // __H__UG__PLUGINS__D3F__FRACT_EVAL__
258
259/* End of File */
static const size_t maxElemCorners
static const size_t maxLayerSideCorners
grid_dim_traits< dim >::grid_base_object element_type
grid_dim_traits< dim >::side_type side_type
Definition fract_eval.h:37
void get_local_coord(side_type *side, size_t num_co, position_accessor_type &aaPos, position_type &global, MathVector< dim-1 > &local)
gets the local coordinates of the intersection
Definition fract_eval_impl.h:131
std::vector< t_fract_pnt_data > m_values
to keep the values
Definition fract_eval.h:248
static const int dim
world dimension
Definition fract_eval.h:50
void check_values()
checks whether all the values are initialized
Definition fract_eval_impl.h:219
std::string get_as_string(const char *inner_sep, const char *outer_sep)
composes a string containing the values
Definition fract_eval.h:173
size_t num_intersections() const
returns the number of the values
Definition fract_eval.h:137
void init_and_check(const char *cmp_name)
completes the initialization and checks the data
Definition fract_eval_impl.h:68
static const size_t maxLayerSideCorners
max. number of corners of non-degenerated sides
Definition fract_eval.h:74
bool is_intersected(element_type *elem, Grid &grid, position_accessor_type &aaPos, position_type &intersection, size_t &num_fract_co, side_type *&inner_side, size_t inner_side_corners[], size_t ass_co[])
checks if the element and finds the intersection point with the inner side
Definition fract_eval_impl.h:92
size_t m_fct
the component of the grid function
Definition fract_eval.h:242
void get_and_write(std::ostream &out, const char *inner_sep, const char *outer_sep)
computes and writes the values into a given stream
Definition fract_eval.h:161
position_type m_point_0
one point on the line
Definition fract_eval.h:245
void get_co_values(element_type *elem, side_type *side, size_t num_fract_co, size_t inner_side_corners[], size_t ass_co[], MathVector< dim-1 > &local, number &inner_val, number &outer_val)
gets values in the intersected element
Definition fract_eval_impl.h:153
deg_layer_mngr_type::side_type side_type
type of sides of the degenerated elements
Definition fract_eval.h:68
void append_values(const side_type *side, const position_type &intersection, number inner_val, number outer_val)
appends the values into the list
Definition fract_eval_impl.h:193
number fract_value(size_t i) const
returns the fracture values no. i
Definition fract_eval.h:143
domain_type::position_type position_type
type of the vectors for positions
Definition fract_eval.h:56
LFEID m_lfeID
the local finite element id
Definition fract_eval.h:243
DegeneratedLayerManager< dim > deg_layer_mngr_type
type of the degenerated layer manager
Definition fract_eval.h:62
position_type position(size_t i) const
returns the coordinates of the intersection nu. i
Definition fract_eval.h:140
domain_type::position_accessor_type position_accessor_type
type of the position accessor
Definition fract_eval.h:59
number side_value_1(size_t i) const
returns the 1st side values no. i
Definition fract_eval.h:146
TGridFunc grid_func_type
grid function type
Definition fract_eval.h:47
static const size_t maxElemCorners
max. number of corners of the elements
Definition fract_eval.h:71
void get_all_values()
gets all values in all the intersected elements
Definition fract_eval_impl.h:230
SmartPtr< deg_layer_mngr_type > m_spDegLayerMngr
the degenerated manager
Definition fract_eval.h:244
SmartPtr< grid_func_type > m_spGridFunc
the grid function
Definition fract_eval.h:241
position_type m_point_1
another point on the line
Definition fract_eval.h:246
TGridFunc::domain_type domain_type
domain type
Definition fract_eval.h:41
number side_value_2(size_t i) const
returns the 2nd side values no. i
Definition fract_eval.h:149
TGridFunc::algebra_type algebra_type
algebra type
Definition fract_eval.h:44
deg_layer_mngr_type::element_type element_type
type of the degenerated elements
Definition fract_eval.h:65
domain_type::grid_type grid_type
grid type
Definition fract_eval.h:53
void write(std::ostream &out, const char *inner_sep, const char *outer_sep) const
writes all the values into a given stream
Definition fract_eval_impl.h:267
SmartPtr< TGrid > grid()
double number
an auxiliary structure for the computed data
Definition fract_eval.h:80
number fract_val
value in the fracture
Definition fract_eval.h:85
t_fract_pnt_data(const t_fract_pnt_data &op)
Definition fract_eval.h:102
t_fract_pnt_data(const side_type *the_face, const position_type &the_intersection, number the_fract_val, number the_side_val)
Definition fract_eval.h:91
number side_val[2]
values at the sides of the fractures
Definition fract_eval.h:86
position_type intersection
(global) coordinates of the intersection
Definition fract_eval.h:83
bool closed
if the two side values have been already initialized
Definition fract_eval.h:88
const side_type * face
the inner face of the fracture
Definition fract_eval.h:81