COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
coFixUsg.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_CELLTOVERT_H
9 #define CO_CELLTOVERT_H
10 
11 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
12 // ++ (C)2005 Visenso ++
13 // ++ Description: Remove unused points ++
14 // ++ ( FixUsg module functionality ) ++
15 // ++ ++
16 // ++ Author: Sven Kufer( sk@visenso.de) ++
17 // ++ ++
18 // ++**********************************************************************/
19 
20 #include <covise/covise.h>
21 
22 namespace covise
23 {
24 class coDistributedObject;
25 
27 {
28 private:
30  //
31  // old module parameters: max_vertices_ in boundingBox, delta_ sphere to merge points, opt_mem_ to
32  // optimize memory usage
33  //
35 
37  float delta_;
38  bool opt_mem_;
39 
40  bool isEqual(float x1, float y1, float z1,
41  float x2, float y2, float z2, float dist);
42 
43  void computeCell(int *replBy, const float *xcoord, const float *ycoord, const float *zcoord,
44  const int *coordInBox, int numCoordInBox,
45  float bbx1, float bby1, float bbz1,
46  float bbx2, float bby2, float bbz2,
47  bool optimize, float maxDistanceSqr, int maxCoord,
48  int recurseLevel = 0);
49 
50  void boundingBox(const float *const *x, const float *const *y, const float *const *z, const int *c, int n,
51  float *bbx1, float *bby1, float *bbz1,
52  float *bbx2, float *bby2, float *bbz2);
53 
54  int getOctant(float x, float y, float z, float ox, float oy, float oz);
55  void getOctantBounds(int o, float ox, float oy, float oz,
56  float bbx1, float bby1, float bbz1,
57  float bbx2, float bby2, float bbz2,
58  float *bx1, float *by1, float *bz1,
59  float *bx2, float *by2, float *bz2);
60 
61  // for replace list
62  enum
63  {
64  UNTOUCHED = -2,
65  REMOVE = -1
66  };
67  enum
68  {
69  UNCHANGED = -1
70  };
71 
72  void computeWorkingLists(int num_coord, int *replyBy, int **src2fil, int **fil2src, int &num_target);
73 
74 public:
75  coFixUsg();
76  coFixUsg(int max_vertices, float delta, bool opt_mem = false);
77 
78  enum
79  {
80  FIX_ERROR = -1
81  };
82 
84  //
85  // Remove unused points
86  // @param geo_in: UNSGRD, LINES, POLYGN
87  // @param geoObjName: Object name for outgoing geometry object
88  // @param numVal: number of data values
89  // @param data_in: list of USTSDT or USTVDT objects
90  // @param objName: list of object names for outgoing data objects
91  //
92  // @param geo_out : simplified geo_in
93  // @param data_out : simplified list data_in
94  // @return : number of reduced points, coFixUsg::FIX_ERROR in case of an error
95  //
97  int fixUsg(const coDistributedObject *geo_in, coDistributedObject **geo_out, const char *geoObjName, int num_val,
98  const coDistributedObject *const *data_in, coDistributedObject **data_out, const char **objName);
99 
101  //
102  // As above but with arrays instead of DO's
103  //
105  int fixUsg(int num_elem, int num_conn, int num_point,
106  const int *elem_list, const int *conn_list, const int *type_list,
107  const float *xcoord, const float *ycoord, const float *zcoord,
108  int &new_num_elem, int &new_num_conn, int &new_num_coord,
109  int **new_elem_list, int **new_conn_list, int **new_type_list,
110  float **new_xcoord, float **new_ycoord, float **new_zcoord,
111  int num_val, int *numComp, int *dataSize,
112  float **in_x, float **in_y, float **in_z,
113  float ***out_x, float ***out_y, float ***out_z);
114 
115  //
116  // fill target array by: target[i] = src[ filtered2source[i] ]
117  //
118  template <class T>
119  void mapArray(const T *src, T *target, const int *filtered2source, int num_target);
120 
121  //
122  // update target array by: target[i] = source2filtered[ src[i] ] ]
123  //
124  template <class T>
125  void updateArray(const T *src, T *target, const int *source2filtered, int num_target);
126 };
127 }
128 
129 #endif
GLint GLint GLint GLint GLint GLint y
Definition: khronos-glext.h:6346
GLenum src
Definition: khronos-glext.h:7031
int * replBy
Definition: DeleteUnusedPoints.h:30
void computeWorkingLists(int num_coord)
Definition: DeleteUnusedPoints.cpp:559
#define ALGEXPORT
Definition: coExport.h:313
GLint GLint GLint GLint GLint x
Definition: khronos-glext.h:6346
GLdouble n
Definition: khronos-glext.h:8447
GLenum GLsizei dataSize
Definition: khronos-glext.h:12392
GLfixed GLfixed GLfixed y2
Definition: khronos-glext.h:11325
void boundingBox(float **x, float **y, float **z, int *c, int n, float *bbx1, float *bby1, float *bbz1, float *bbx2, float *bby2, float *bbz2)
Definition: DeleteUnusedPoints.cpp:159
int getOctant(float x, float y, float z, float ox, float oy, float oz)
Definition: DeleteUnusedPoints.cpp:220
GLdouble GLdouble z
Definition: khronos-glext.h:6565
int isEqual(float x1, float y1, float z1, float x2, float y2, float z2, float dist)
Definition: DeleteUnusedPoints.cpp:198
GLfixed GLfixed x2
Definition: khronos-glext.h:11325
int * source2filtered
Definition: DeleteUnusedPoints.h:33
GLuint GLfloat GLfloat GLfloat x1
Definition: khronos-glext.h:13144
int max_vertices_
Definition: coFixUsg.h:36
int * filtered2source
Definition: DeleteUnusedPoints.h:32
const GLubyte * c
Definition: khronos-glext.h:9864
void getOctantBounds(int o, float ox, float oy, float oz, float bbx1, float bby1, float bbz1, float bbx2, float bby2, float bbz2, float *bx1, float *by1, float *bz1, float *bx2, float *by2, float *bz2)
Definition: DeleteUnusedPoints.cpp:257
bool opt_mem_
Definition: coFixUsg.h:38
GLfixed y1
Definition: khronos-glext.h:11325
Definition: coDistributedObject.h:294
void computeCell(float *xcoord, float *ycoord, float *zcoord, int *coordInBox, int numCoordInBox, float bbx1, float bby1, float bbz1, float bbx2, float bby2, float bbz2, int optimize, float maxDistanceSqr, int maxCoord)
Definition: DeleteUnusedPoints.cpp:335
float delta_
Definition: coFixUsg.h:37
Definition: coFixUsg.h:26
GLenum target
Definition: khronos-glext.h:8033