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  *dx = ((float)x_max - (float)x_min) / (int)(x_disc - 1);
113  *dy = ((float)y_max - (float)y_min) / (int)(y_disc - 1);
114  *dz = ((float)z_max - (float)z_min) / (int)(z_disc - 1);
115  }
116 
117  virtual void getGridSize(int *x, int *y, int *z) const
118  {
119  *x = x_disc;
120  *y = y_disc;
121  *z = z_disc;
122  }
123 
124  void getMinMax(float *xmin, float *xmax,
125  float *ymin, float *ymax,
126  float *zmin, float *zmax) const
127  {
128  *xmin = x_min;
129  *xmax = x_max;
130  *ymin = y_min;
131  *ymax = y_max;
132  *zmin = z_min;
133  *zmax = z_max;
134  }
135 
136  virtual void getPointCoordinates(int i, float *x_c,
137  int j, float *y_c,
138  int k, float *z_c) const
139  {
140  if (x_disc > 1)
141  *x_c = x_min + ((float)i / (float)(x_disc - 1.0)) * (x_max - x_min);
142  else
143  *x_c = x_min;
144  if (y_disc > 1)
145  *y_c = y_min + ((float)j / (float)(y_disc - 1.0)) * (y_max - y_min);
146  else
147  *y_c = y_min;
148  if (z_disc > 1)
149  *z_c = z_min + ((float)k / (float)(z_disc - 1.0)) * (z_max - z_min);
150  else
151  *z_c = z_min;
152  }
153 
154  virtual int interpolateField(float *v_interp, const float *point,
155  int *cell, int no_arrays, int array_dim,
156  const float *const *velo);
157 };
158 }
159 #endif
virtual void getPointCoordinates(int i, float *x_c, int j, float *y_c, int k, float *z_c) const
Definition: coDoUniformGrid.h:136
GLuint const GLchar * name
Definition: khronos-glext.h:6722
virtual ~coDoUniformGrid()
Definition: coDoUniformGrid.h:106
Definition: covise_shm.h:481
GLint GLint GLint GLint GLint GLint y
Definition: khronos-glext.h:6346
coFloatShm x_min
Definition: coDoUniformGrid.h:62
virtual void getGridSize(int *x, int *y, int *z) const
Definition: coDoUniformGrid.h:117
Definition: covise_statics.cpp:54
GLclampd zmax
Definition: khronos-glext.h:11392
coFloatShm y_max
Definition: coDoUniformGrid.h:65
GLdouble GLdouble z
Definition: khronos-glext.h:6565
Definition: coDoAbstractStructuredGrid.h:53
coIntShm z_disc
Definition: coDoUniformGrid.h:61
coFloatShm y_min
Definition: coDoUniformGrid.h:64
coIntShm x_disc
Definition: coDoUniformGrid.h:59
Definition: coObjID.h:230
GLint GLint GLint GLint GLint x
Definition: khronos-glext.h:6346
Definition: coDistributedObject.h:266
coIntShm y_disc
Definition: coDoUniformGrid.h:60
Definition: coDoUniformGrid.h:53
#define DOEXPORT
Definition: coExport.h:307
void getMinMax(float *xmin, float *xmax, float *ymin, float *ymax, float *zmin, float *zmax) const
Definition: coDoUniformGrid.h:124
void print_comment(int line, const char *filename, const char *fmt,...)
Definition: coLog.cpp:25
coFloatShm z_min
Definition: coDoUniformGrid.h:66
coFloatShm z_max
Definition: coDoUniformGrid.h:67
coDoUniformGrid(const coObjInfo &info)
Definition: coDoUniformGrid.h:78
coFloatShm x_max
Definition: coDoUniformGrid.h:63
Definition: coDistributedObject.h:295
static coShmArray * getShmArray(const char *name)
Definition: coDistributedObject.cpp:60
void getDelta(float *dx, float *dy, float *dz) const
Definition: coDoUniformGrid.h:110