COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
coUniTracer.h
Go to the documentation of this file.
1 /* This file is part of COVISE.
2 
3  You can use it under the terms of the GNU Lesser General Public License
4  version 2.1 or later, see lgpl-2.1.txt.
5 
6  * License: LGPL 2+ */
7 
8 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
9 // CLASS coUniTracer
10 //
11 // An object of this class may be used to work out
12 // a streamline in a uniform grid.
13 //
14 // Initial version: 24.06.2004 sl
15 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
16 // (C) 2004 by VirCinity IT Consulting
17 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
18 // Changes:
19 
20 #ifndef CO_UNI_TRACER_H
21 #define CO_UNI_TRACER_H
22 
23 #include <vector>
24 #include <util/coExport.h>
25 
26 namespace covise
27 {
28 
29 // coUniState is an auxiliary structure
30 // representing a "state" during particle integration.
31 // It consists of point, velocity and integration time
32 struct coUniState
33 {
34  float point_[3];
35  float velocity_[3];
36  float time_;
37 };
38 
40 {
41 public:
44  coUniTracer(float xmin, float xmax, float ymin, float ymax,
45  float zmin, float zmax, int nx, int ny, int nz,
46  const float *u, const float *v, const float *w);
48  virtual ~coUniTracer();
60  void solve(const float *yini, std::vector<coUniState> &solution, float eps_rel,
61  float max_length = 2.0, float vel_factor = 0.005, int ts = 1) const;
62 
63 protected:
64 private:
65  // interpolate returns true when a point y is in the the uniform grid
66  // and writes the interpolated speed in dydx
67  bool interpolate(const float *y, float *dydx) const;
68  // getInitialH returns a "reasonable" value for the integration
69  // step given a point and a speed (previously calculated with interpolate)
70  float getInitialH(const float *y, const float *dydx) const;
71  // stop returns true when the integration is to be interrupted because
72  // the speed is too low
73  bool stop(float factor, const std::vector<coUniState> &solu) const;
74  // rkqs is a stepper using rkck. See Tracer module for documentation
75  bool rkqs(float *y, const float *dydx, float *x,
76  float h, float eps, float eps_abs,
77  const float *yscal,
78  float *hdid, float *hnext) const;
79 
80  // rkck performs a Runge-Kutta step. See Tracer module for documentation
81  bool rkck(const float *y, const float *dydx,
82  float x, float h, float yout[], float yerr[]) const;
83 
84  // uniform grid dimensions
85  float xmin_;
86  float ymin_;
87  float zmin_;
88  float xmax_;
89  float ymax_;
90  float zmax_;
91  // model characteristic length
93  // number of node divisions
94  int nx_;
95  int ny_;
96  int nz_;
97  // grid cell dimensions
98  float dx_;
99  float dy_;
100  float dz_;
101  // velocity field arrays
102  const float *u_;
103  const float *v_;
104  const float *w_;
105  // highest velocity
106  float max_vel_;
107  // time direction
108 };
109 }
110 #endif
GLint GLint GLint GLint GLint GLint y
Definition: khronos-glext.h:6346
const float * v_
Definition: coUniTracer.h:103
int nz_
Definition: coUniTracer.h:96
float dy_
Definition: coUniTracer.h:99
GLfloat GLfloat nz
Definition: khronos-glext.h:9855
float ymin_
Definition: coUniTracer.h:86
#define ALGEXPORT
Definition: coExport.h:313
GLint GLint GLint GLint GLint x
Definition: khronos-glext.h:6346
float zmax_
Definition: coUniTracer.h:90
const GLdouble * v
Definition: khronos-glext.h:6442
float dz_
Definition: coUniTracer.h:100
GLfloat ny
Definition: khronos-glext.h:9855
GLubyte GLubyte GLubyte GLubyte w
Definition: khronos-glext.h:6793
int nx_
Definition: coUniTracer.h:94
float model_length_
Definition: coUniTracer.h:92
GLclampd zmax
Definition: khronos-glext.h:11392
float xmin_
Definition: coUniTracer.h:85
float max_vel_
Definition: coUniTracer.h:106
const float * w_
Definition: coUniTracer.h:104
float point_[3]
Definition: coUniTracer.h:34
const float * u_
Definition: coUniTracer.h:102
float dx_
Definition: coUniTracer.h:98
Definition: coUniTracer.h:32
GLfloat GLfloat GLfloat GLfloat nx
Definition: khronos-glext.h:9857
GLfloat GLfloat GLfloat GLfloat h
Definition: khronos-glext.h:8441
float time_
Definition: coUniTracer.h:36
float xmax_
Definition: coUniTracer.h:88
float velocity_[3]
Definition: coUniTracer.h:35
float ymax_
Definition: coUniTracer.h:89
Definition: coUniTracer.h:39
float zmin_
Definition: coUniTracer.h:87
int ny_
Definition: coUniTracer.h:95