COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
coDoUniformGrid.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 #ifndef CO_DO_UNIFORM_GRID_H
9 #define CO_DO_UNIFORM_GRID_H
10 
12 
13 /*
14  $Log: $
15  * Revision 1.2 1993/10/21 21:44:38 zrfg0125
16  * bugs in type fixed
17  *
18  * Revision 1.1 93/09/25 20:51:34 zrhk0125
19  * Initial revision
20  *
21 */
22 
23 /***********************************************************************\
24  ** **
25  ** Structured class Version: 1.1 **
26  ** **
27  ** **
28  ** Description : Classes for the handling of a structured grid **
29  ** and the data on it in a distributed manner. **
30  ** **
31  ** Classes : coDoGeometry, coDoStructuredGrid, **
32  ** DO_Scalar_3d_data, DO_Vector_3d_data, **
33  ** DO_Solution **
34  ** **
35  ** Copyright (C) 1993 by University of Stuttgart **
36  ** Computer Center (RUS) **
37  ** Allmandring 30 **
38  ** 7000 Stuttgart 80 **
39  ** **
40  ** **
41  ** Author : A. Wierse (RUS) **
42  ** **
43  ** History : **
44  ** 15.04.93 Ver 1.0 **
45  ** 26.05.93 Ver 1.1 new Shm-Datatypes introduced **
46  ** redesign of rebuildFromShm **
47  ** **
48  ** **
49 \***********************************************************************/
50 namespace covise
51 {
52 
54 {
55  friend class coDoInitializer;
56  static coDistributedObject *virtualCtor(coShmArray *arr);
57 
58 private:
59  coIntShm x_disc; // number of points in x-direction (X)
60  coIntShm y_disc; // number of points in y-direction (Y)
61  coIntShm z_disc; // number of points in z-direction (Z)
62  coFloatShm x_min; // minimum x-value
63  coFloatShm x_max; // maximum x-value
64  coFloatShm y_min; // minimum y-value
65  coFloatShm y_max; // maximum y-value
66  coFloatShm z_min; // minimum z-value
67  coFloatShm z_max; // maximum z-value
68 
69 protected:
70  int rebuildFromShm();
71  int getObjInfo(int, coDoInfo **) const;
72  coDoUniformGrid *cloneObject(const coObjInfo &newinfo) const;
73 
74 public:
76  void SwapMinMax(int dimension);
77 
79  : coDoAbstractStructuredGrid(info, "UNIGRD")
80  {
81  if (name)
82  {
83  if (getShmArray() != 0)
84  {
85  if (rebuildFromShm() == 0)
86  {
87  print_comment(__LINE__, __FILE__, "rebuildFromShm == 0");
88  }
89  }
90  else
91  {
92  print_comment(__LINE__, __FILE__, "object %s doesn't exist", name);
93  new_ok = 0;
94  }
95  }
96  }
97 
98  coDoUniformGrid(const coObjInfo &info, coShmArray *arr);
99  coDoUniformGrid(const coObjInfo &info, int x, int y, int z,
100  float xmin, float xmax, float ymin,
101  float ymax, float zmin, float zmax);
102  coDoUniformGrid(const coObjInfo &info,
103  float dx, float dy, float dz,
104  float xmin, float xmax, float ymin,
105  float ymax, float zmin, float zmax);
107  {
108  }
109 
110  void getDelta(float *dx, float *dy, float *dz) const
111  {
112  if (x_disc > 1)
113  *dx = ((float)x_max - (float)x_min) / (int)(x_disc - 1);
114  else
115  *dx = 0.f;
116  if (y_disc > 1)
117  *dy = ((float)y_max - (float)y_min) / (int)(y_disc - 1);
118  else
119  *dy = 0.f;
120  if (z_disc > 1)
121  *dz = ((float)z_max - (float)z_min) / (int)(z_disc - 1);
122  else
123  *dz = 0.f;
124  }
125 
126  virtual void getGridSize(int *x, int *y, int *z) const
127  {
128  *x = x_disc;
129  *y = y_disc;
130  *z = z_disc;
131  }
132 
133  void getMinMax(float *xmin, float *xmax,
134  float *ymin, float *ymax,
135  float *zmin, float *zmax) const
136  {
137  *xmin = x_min;
138  *xmax = x_max;
139  *ymin = y_min;
140  *ymax = y_max;
141  *zmin = z_min;
142  *zmax = z_max;
143  }
144 
145  virtual void getPointCoordinates(int i, float *x_c,
146  int j, float *y_c,
147  int k, float *z_c) const
148  {
149  if (x_disc > 1)
150  *x_c = x_min + ((float)i / (float)(x_disc - 1.0)) * (x_max - x_min);
151  else
152  *x_c = x_min;
153  if (y_disc > 1)
154  *y_c = y_min + ((float)j / (float)(y_disc - 1.0)) * (y_max - y_min);
155  else
156  *y_c = y_min;
157  if (z_disc > 1)
158  *z_c = z_min + ((float)k / (float)(z_disc - 1.0)) * (z_max - z_min);
159  else
160  *z_c = z_min;
161  }
162 
163  virtual int interpolateField(float *v_interp, const float *point,
164  int *cell, int no_arrays, int array_dim,
165  const float *const *velo);
166 };
167 }
168 #endif
coFloatShm x_min
Definition: coDoUniformGrid.h:62
virtual void getGridSize(int *x, int *y, int *z) const
Definition: coDoUniformGrid.h:126
GLdouble GLdouble z
Definition: khronos-glext.h:6565
coFloatShm y_max
Definition: coDoUniformGrid.h:65
coIntShm z_disc
Definition: coDoUniformGrid.h:61
coIntShm x_disc
Definition: coDoUniformGrid.h:59
virtual void getPointCoordinates(int i, float *x_c, int j, float *y_c, int k, float *z_c) const
Definition: coDoUniformGrid.h:145
#define DOEXPORT
Definition: coExport.h:319
GLuint const GLchar * name
Definition: khronos-glext.h:6722
virtual ~coDoUniformGrid()
Definition: coDoUniformGrid.h:106
Definition: coObjID.h:230
coFloatShm z_max
Definition: coDoUniformGrid.h:67
coDoUniformGrid(const coObjInfo &info)
Definition: coDoUniformGrid.h:78
coFloatShm y_min
Definition: coDoUniformGrid.h:64
GLint GLint GLint GLint GLint GLint y
Definition: khronos-glext.h:6346
coIntShm y_disc
Definition: coDoUniformGrid.h:60
Definition: covise_statics.cpp:54
void getDelta(float *dx, float *dy, float *dz) const
Definition: coDoUniformGrid.h:110
Definition: covise_shm.h:481
Definition: coDoAbstractStructuredGrid.h:53
void getMinMax(float *xmin, float *xmax, float *ymin, float *ymax, float *zmin, float *zmax) const
Definition: coDoUniformGrid.h:133
void print_comment(int line, const char *filename, const char *fmt,...)
Definition: coLog.cpp:25
GLint GLint GLint GLint GLint x
Definition: khronos-glext.h:6346
Definition: coDistributedObject.h:295
GLclampd zmax
Definition: khronos-glext.h:11392
coFloatShm z_min
Definition: coDoUniformGrid.h:66
Definition: coDistributedObject.h:266
static coShmArray * getShmArray(const char *name)
Definition: coDistributedObject.cpp:60
Definition: coDoUniformGrid.h:53
coFloatShm x_max
Definition: coDoUniformGrid.h:63