1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
/*
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2010 - DIGITEO - Manuel Juliachs
*
* This file must be used under the terms of the CeCILL.
* This source file is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at
* http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
*
*/
#ifndef MESH_DATA_HXX
#define MESH_DATA_HXX
#include "Data3D.hxx"
extern "C" {
#include "BOOL.h"
}
/**
* Mesh data class
*/
class MeshData: public Data3D
{
protected:
/**
* Vertex coordinates array
* Contiguous (x, y, z) triplets
*/
double* vertices;
/** Element indices array
* Contiguous (v0, v1, v2, ...) triplets
*/
unsigned int* indices;
/**
* Per-vertex or per-facet scalar values
* Considered to be per-vertex for now
* To be correctly implemented
*/
double* values;
/** Number of vertices */
unsigned int numberVertices;
/** Number of elements */
unsigned int numberElements;
unsigned int numberVerticesByElem;
public:
/**
* Constructor
*/
MeshData(void);
/**
* Constructor
* To be implemented
*/
MeshData(unsigned int numberVertices, unsigned int numberElements, unsigned int numberVerticesByElem = 3);
/**
* Destructor
*/
virtual ~MeshData();
/**
* Returns the identifier associated to a property name
* @param[in] propertyName the property name
* @return the property identifier
*/
int getPropertyFromName(int propertyName);
/**
* Sets a data property
* @param[in] property the property identifier
* @param[in] value a pointer to the property values
* @param[in] numElements the number of elements to set
* @return 1 if the property has been successfully set, 0 otherwise
*/
int setDataProperty(int property, void const* value, int numElements);
/**
* Returns a data property
* @param[in] property the property identifier
* @param[out] a pointer to a pointer to the returned property values
*/
void getDataProperty(int property, void **_pvData);
/**
* Returns the number of vertices composing the mesh
* @return the number of vertices
*/
unsigned int getNumVertices();
/**
* Sets the number of vertices
* Resizes the vertex array if required
* @param[in] numVertices the number of vertices to set
* @return 1 if the number of vertices has been successfully set, 0 otherwise (failed allocation)
*/
int setNumVertices(unsigned int numVertices);
/**
* Returns the number of index triplets (number of elements)
* @return the number of index triplets
*/
unsigned int getNumIndices();
/**
* Returns the array of vertex coordinates
* @return a pointer to the array of vertex coordinates
*/
double* getVertices(void);
/**
* Sets vertex coordinates
* @param[in] vertices a pointer the array of vertex {x,y,z} coordinates to set
* @param[in] numElements the number of vertices
*/
void setVertices(double const* vertices, unsigned int numElements);
/**
* Returns the array of indices
* @return a pointer to the array indices
*/
unsigned int* getIndices(void);
/**
* Sets the number of index triplets
* Resizes the array of indices if required
* @param[in] numIndices the number of index triplets to set
* @return 1 if the number of index triplets has been successfully set, 0 otherwise (failed allocation)
*/
int setNumIndices(unsigned int numIndices);
/**
* Sets the array of index triplet values
* @param[in] indices a pointer to the array of index triplet values
* @param[in] numElements the number of triplets
*/
void setIndices(unsigned int const* indices, unsigned int numElements);
/**
* Sets the x coordinates
* @param[in] data a pointer to the array of x coordinates
* @param[in] numElements the number of x coordinates to set
*/
void setDataX(double const* data, unsigned int numElements);
/**
* Sets the y coordinates
* @param[in] data a pointer to the array of y coordinates
* @param[in] numElements the number of y coordinates to set
*/
void setDataY(double const* data, unsigned int numElements);
/**
* Sets the z coordinates
* @param[in] data a pointer to the array of z coordinates
* @param[in] numElements the number of z coordinates to set
*/
void setDataZ(double const* data, unsigned int numElements);
/**
* Returns the array of per-vertex values
* @return a pointer to the array of per-vertex values
*/
double* getValues(void);
/**
* Sets the array of per-vertex values
* @param[in] data a pointer to the array of per-vertex values
* @param[in] numElements the number of values to set
*/
void setValues(double const* data, unsigned int numElements);
/**
* Resets the vertex coordinates
*/
void resetCoordinates(void);
/**
* Converts a vertex index as seen by Scilab to an internal format vertex index
* @param[in] scilabIndex the Scilab index to convert
* @return the internal format vertex index
*/
static unsigned int scilabIndexToIndex(unsigned int scilabIndex);
};
#endif
|