COVISE Core
coDoPolygons.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_POLYGONS_H
9#define CO_DO_POLYGONS_H
10
11#include "coDoGrid.h"
12#include "coDoLines.h"
13
14/*
15 $Log: covise_unstr.h,v $
16 * Revision 1.1 1993/09/25 20:52:42 zrhk0125
17 * Initial revision
18 *
19*/
20
21/***********************************************************************\
22 ** **
23 ** Untructured class Version: 1.0 **
24 ** **
25 ** **
26 ** Description : Classes for the handling of an unstructured grid **
27 ** and the data on it in a distributed manner. **
28 ** **
29 ** Classes : **
30 ** **
31 ** Copyright (C) 1993 by University of Stuttgart **
32 ** Computer Center (RUS) **
33 ** Allmandring 30 **
34 ** 7000 Stuttgart 80 **
35 ** **
36 ** **
37 ** Author : A. Wierse (RUS) **
38 ** **
39 ** History : **
40 ** 23.06.93 Ver 1.0 **
41 ** **
42 ** **
43\***********************************************************************/
44
45namespace covise
46{
47
48class coDoOctTreeP;
49
51{
52 friend class coDoInitializer;
53 static coDistributedObject *virtualCtor(coShmArray *arr);
54 mutable int *lnl;
55 mutable int *lnli;
56 mutable int numneighbor;
57 mutable int numelem;
58 mutable int numconn;
60 mutable int *el, *cl;
61 float *x_c_, *y_c_, *z_c_;
63
64 int testACell(float *v_interp, const float *point,
65 int cell, int no_arrays, int array_dim,
66 float tolerance, const float *const *velo) const;
67
68 void MakeOctTree(const char *octSurname) const;
69
70 float Distance(int cell, const float *point) const;
71 void Project(float *point, int cell) const;
72
73protected:
75 int rebuildFromShm();
76 int getObjInfo(int, coDoInfo **) const;
77 coDoPolygons *cloneObject(const coObjInfo &newinfo) const;
78
79public:
82 : coDoGrid(info, "POLYGN")
83 , lnl(NULL)
84 , lnli(NULL)
85 , oct_tree(NULL)
86 {
87 lines = new coDoLines(coObjInfo());
88 if (name)
89 {
90 if (getShmArray() != 0)
91 {
92 if (rebuildFromShm() == 0)
93 {
94 print_comment(__LINE__, __FILE__, "rebuildFromShm == 0");
95 }
96 }
97 else
98 {
99 print_comment(__LINE__, __FILE__, "object %s doesn't exist", name);
100 new_ok = 0;
101 }
102 }
103 };
104 coDoPolygons(const coObjInfo &info, coShmArray *arr);
105 coDoPolygons(const coObjInfo &info, int no_p, int no_v, int no_l);
106 coDoPolygons(const coObjInfo &info, int no_p, float *x_c,
107 float *y_c, float *z_c, int no_v, int *v_l, int no_pol, int *pol_l);
108 int getNumPolygons() const
109 {
110 return lines->getNumLines();
111 }
113 {
114 return lines->setNumLines(num);
115 }
116 int getNumVertices() const
117 {
118 return lines->getNumVertices();
119 }
121 {
122 return lines->setNumVertices(num);
123 }
124 int getNumPoints() const
125 {
126 return lines->getNumPoints();
127 }
129 {
130 return lines->setNumPoints(num);
131 }
132 int getNeighbor(int element, int n1, int n2);
133 int getNeighbors(int element, int n1, int *neighbors);
134 void getNeighborList(int *n, int **l, int **li) const
135 {
136 if (1)
137 {
138 computeNeighborList();
139 *l = lnl;
140 *li = lnli;
141 numneighbor = lines->getNumVertices();
142 }
143 else
144 {
145 // *l = (int *)neighborlist.getDataPtr();
146 // *li = (int *)neighborindex.getDataPtr();
147 }
148 *n = numneighbor;
149 };
150 void getAddresses(float **x_c, float **y_c, float **z_c, int **v_l, int **l_l) const
151 {
152 lines->getAddresses(x_c, y_c, z_c, v_l, l_l);
153 };
154 void computeNeighborList() const;
155 // For interpolation the function assumes that the input
156 // consists of vertex-based data.
157 // velo is an array of $no_arrays pointers to float arrays,
158 // whose contents are grouped in groups of $array_dim floats.
159 // These groups are values for a point. This organisation
160 // is so complicated because of the unfelicitous fact that
161 // scalars and tensors are defined in a unique array and
162 // vectors in three. So if you get a scalar, you typically
163 // have no_arrays==1 and array_dim==1. If you get a vector,
164 // no_arrays==3 and array_dim==1. And if you get a tensor,
165 // then no_arrays==1 and array_dim==dimensionality of tensor type.
166 // The organisation of the output is as follows:
167 // cell is an array with 3 integer values determining the cell.
168 // v_interp contains no_arrays groups of array_dim floats:
169 // the caller is responsible for memory allocation.
170 int interpolateField(float *v_interp, float *point,
171 int *cell, int no_arrays, int array_dim,
172 float tolerance, const float *const *velo,
173 int search_level) const;
174 // make sure there is an octree, before using interpolateField
175 const coDoOctTreeP *GetOctTree(const coDistributedObject *reuseOctTree,
176 const char *OctTreeSurname) const;
177};
178
180{
181 friend class coDoInitializer;
182 static coDistributedObject *virtualCtor(coShmArray *arr);
185
186protected:
188 int rebuildFromShm();
189 int getObjInfo(int, coDoInfo **) const;
190 coDoTriangles *cloneObject(const coObjInfo &newinfo) const;
191
192public:
194 : coDoGrid(info, "TRITRI")
195 {
196 points = new coDoPoints(coObjInfo());
197 if (name)
198 {
199 if (getShmArray() != 0)
200 {
201 if (rebuildFromShm() == 0)
202 {
203 print_comment(__LINE__, __FILE__, "rebuildFromShm == 0");
204 }
205 }
206 else
207 {
208 print_comment(__LINE__, __FILE__, "object %s doesn't exist", name);
209 new_ok = 0;
210 }
211 }
212 };
213 coDoTriangles(const coObjInfo &info, coShmArray *arr);
214 coDoTriangles(const coObjInfo &info, int no_p, int no_v);
215 coDoTriangles(const coObjInfo &info, int no_p,
216 float *x_c, float *y_c, float *z_c, int no_v, int *v_l);
217 int getNumTriangles() const
218 {
219 return no_of_vertices / 3;
220 }
221 int getNumVertices() const
222 {
223 return no_of_vertices;
224 }
225 int setNumVertices(int num_elem);
226 int getNumPoints() const
227 {
228 return points->getNumPoints();
229 }
231 {
232 return points->setSize(num);
233 };
234 void getAddresses(float **x_c, float **y_c, float **z_c, int **v_l) const
235 {
236 points->getAddresses(x_c, y_c, z_c);
237 *v_l = (int *)vertex_list.getDataPtr();
238 };
239};
240
242{
243 friend class coDoInitializer;
244 static coDistributedObject *virtualCtor(coShmArray *arr);
247
248protected:
250 int rebuildFromShm();
251 int getObjInfo(int, coDoInfo **) const;
252 coDoQuads *cloneObject(const coObjInfo &newinfo) const;
253
254public:
255 coDoQuads(const coObjInfo &info)
256 : coDoGrid(info, "QUADS")
257 {
258 points = new coDoPoints(coObjInfo());
259 if (name)
260 {
261 if (getShmArray() != 0)
262 {
263 if (rebuildFromShm() == 0)
264 {
265 print_comment(__LINE__, __FILE__, "rebuildFromShm == 0");
266 }
267 }
268 else
269 {
270 print_comment(__LINE__, __FILE__, "object %s doesn't exist", name);
271 new_ok = 0;
272 }
273 }
274 };
275 coDoQuads(const coObjInfo &info, coShmArray *arr);
276 coDoQuads(const coObjInfo &info, int no_p, int no_v);
277 coDoQuads(const coObjInfo &info, int no_p,
278 float *x_c, float *y_c, float *z_c, int no_v, int *v_l);
279 int getNumTriangles() const
280 {
281 return no_of_vertices / 3;
282 }
283 int getNumVertices() const
284 {
285 return no_of_vertices;
286 }
287 int setNumVertices(int num_elem);
288 int getNumPoints() const
289 {
290 return points->getNumPoints();
291 }
293 {
294 return points->setSize(num);
295 };
296 void getAddresses(float **x_c, float **y_c, float **z_c, int **v_l) const
297 {
298 points->getAddresses(x_c, y_c, z_c);
299 *v_l = (int *)vertex_list.getDataPtr();
300 };
301};
302}
303#endif
#define DOEXPORT
Definition: coExport.h:331
#define NULL
Definition: covise_list.h:22
GLdouble n
Definition: khronos-glext.h:8447
GLuint const GLchar * name
Definition: khronos-glext.h:6722
GLuint GLuint num
Definition: khronos-glext.h:10593
GLsizei const GLfloat * points
Definition: khronos-glext.h:9066
list of all chemical elements
Definition: coConfig.h:27
static coShmArray * getShmArray(const char *name)
Definition: coDistributedObject.cpp:60
void print_comment(int line, const char *filename, const char *fmt,...)
Definition: coLog.cpp:25
Definition: coObjID.h:231
Definition: covise_shm.h:482
void * getDataPtr() const
Definition: covise_shm.h:543
Definition: coDistributedObject.h:267
Definition: coDistributedObject.h:296
Definition: coDoGrid.h:17
Definition: coDoLines.h:48
int setNumLines(int num_elem)
Definition: coDoLines.cpp:80
int getNumPoints() const
Definition: coDoLines.h:98
int getNumLines() const
Definition: coDoLines.h:88
int setNumPoints(int num)
Definition: coDoLines.h:102
int setNumVertices(int num_elem)
Definition: coDoLines.cpp:71
void getAddresses(float **x_c, float **y_c, float **z_c, int **v_l, int **l_l) const
Definition: coDoLines.h:106
int getNumVertices() const
Definition: coDoLines.h:93
Definition: coDoOctTreeP.h:32
Definition: coDoPoints.h:48
Definition: coDoPolygons.h:51
int * lnli
Definition: coDoPolygons.h:55
int numpoints
Definition: coDoPolygons.h:59
int setNumPoints(int num)
Definition: coDoPolygons.h:128
int setNumVertices(int num)
Definition: coDoPolygons.h:120
int * cl
Definition: coDoPolygons.h:60
void getAddresses(float **x_c, float **y_c, float **z_c, int **v_l, int **l_l) const
Definition: coDoPolygons.h:150
int getNumPolygons() const
Definition: coDoPolygons.h:108
int getNumVertices() const
Definition: coDoPolygons.h:116
const coDistributedObject * oct_tree
Definition: coDoPolygons.h:62
float * x_c_
Definition: coDoPolygons.h:61
coDoLines * lines
Definition: coDoPolygons.h:74
int numneighbor
Definition: coDoPolygons.h:56
coDoPolygons(const coObjInfo &info)
Definition: coDoPolygons.h:81
int getNumPoints() const
Definition: coDoPolygons.h:124
int numelem
Definition: coDoPolygons.h:57
int numconn
Definition: coDoPolygons.h:58
void getNeighborList(int *n, int **l, int **li) const
Definition: coDoPolygons.h:134
int setNumPolygons(int num)
Definition: coDoPolygons.h:112
int * lnl
Definition: coDoPolygons.h:54
Definition: coDoPolygons.h:180
coDoPoints * points
Definition: coDoPolygons.h:187
int getNumVertices() const
Definition: coDoPolygons.h:221
void getAddresses(float **x_c, float **y_c, float **z_c, int **v_l) const
Definition: coDoPolygons.h:234
int getNumTriangles() const
Definition: coDoPolygons.h:217
int getNumPoints() const
Definition: coDoPolygons.h:226
coDoTriangles(const coObjInfo &info)
Definition: coDoPolygons.h:193
coIntShmArray vertex_list
Definition: coDoPolygons.h:184
coIntShm no_of_vertices
Definition: coDoPolygons.h:183
int setNumPoints(int num)
Definition: coDoPolygons.h:230
Definition: coDoPolygons.h:242
coIntShmArray vertex_list
Definition: coDoPolygons.h:246
int getNumPoints() const
Definition: coDoPolygons.h:288
void getAddresses(float **x_c, float **y_c, float **z_c, int **v_l) const
Definition: coDoPolygons.h:296
int setNumPoints(int num)
Definition: coDoPolygons.h:292
int getNumVertices() const
Definition: coDoPolygons.h:283
coIntShm no_of_vertices
Definition: coDoPolygons.h:245
coDoQuads(const coObjInfo &info)
Definition: coDoPolygons.h:255
coDoPoints * points
Definition: coDoPolygons.h:249
int getNumTriangles() const
Definition: coDoPolygons.h:279
Definition: covise_statics.cpp:55