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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329 | /* *****************************************************************
MESQUITE -- The Mesh Quality Improvement Toolkit
Copyright 2004 Sandia Corporation and Argonne National
Laboratory. Under the terms of Contract DE-AC04-94AL85000
with Sandia Corporation, the U.S. Government retains certain
rights in this software.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
(lgpl.txt) along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
[email protected], [email protected], [email protected],
[email protected], [email protected], [email protected],
[email protected]
***************************************************************** */
//
// SUMMARY:
// USAGE:
//
// ORIG-DATE: 26-March-08 at 10:26:21
// LAST-MOD: 15-Nov-04 by [email protected]
//
/*! \file ParallelMeshImpl.cpp
\brief This files contains a parallel mesh implementation that can be used
to run mesquite by default.
\author Jason Kraftcheck
\author Martin Isenburg
\date 2008-3-26
*/
#include "ParallelMeshImpl.hpp"
#include "MeshImplData.hpp"
#include "MeshImplTags.hpp"
#include "MsqError.hpp"
#include "MsqDebug.hpp"
namespace MBMesquite
{
ParallelMeshImpl::ParallelMeshImpl( Mesh* p_myMesh, const char* gid_name, const char* pid_name )
{
MsqError err;
this->myMesh = p_myMesh;
this->helper = 0;
if( gid_name )
gid_tag = myMesh->tag_get( gid_name, err );
else
gid_tag = 0;
if( pid_name )
pid_tag = myMesh->tag_get( pid_name, err );
else
pid_tag = 0;
}
void ParallelMeshImpl::set_global_id_tag( const char* name, MsqError& err )<--- The function 'set_global_id_tag' is never used.
{
gid_tag = myMesh->tag_get( name, err );
}
void ParallelMeshImpl::set_processor_id_tag( const char* name, MsqError& err )<--- The function 'set_processor_id_tag' is never used.
{
pid_tag = myMesh->tag_get( name, err );
}
//**************** Parallel Methods ******************************
void ParallelMeshImpl::vertices_get_global_id( const VertexHandle vert_array[],
size_t gid[],
size_t num_vtx,
MsqError& err )
{
if( gid_tag )
{
myMesh->tag_get_vertex_data( gid_tag, num_vtx, vert_array, gid, err );MSQ_CHKERR( err );
}
else
{
MSQ_SETERR( err )( "Parallel mesh does not have Global IDs.", MsqError::INVALID_STATE );
}
}
void ParallelMeshImpl::vertices_set_global_id( const VertexHandle vert_array[],<--- The function 'vertices_set_global_id' is never used.
size_t gid[],
size_t num_vtx,
MsqError& err )
{
if( gid_tag == 0 )
{
const char GLOBAL_ID_NAME[] = "GLOBAL_ID";
int default_gid = -1;
gid_tag = tag_create( GLOBAL_ID_NAME, HANDLE, 1, &default_gid, err );
// the 'HANDLE' is the type of data to store
// the '1' is for one value per vertex
// NULL for no default value, if you want them all
// initialized to something, pass in a pointer to an int
// with the value.
MSQ_CHKERR( err );
}
tag_set_vertex_data( gid_tag, num_vtx, vert_array, gid, err );MSQ_CHKERR( err );
}
void ParallelMeshImpl::vertices_get_processor_id( const VertexHandle vert_array[],
int pid[],
size_t num_vtx,
MsqError& err )
{
if( pid_tag )
{
tag_get_vertex_data( pid_tag, num_vtx, vert_array, pid, err );MSQ_CHKERR( err );
}
else
{
MSQ_SETERR( err )( "Parallel mesh does not have Processor IDs.", MsqError::INVALID_STATE );
}
}
void ParallelMeshImpl::vertices_set_processor_id( const VertexHandle vert_array[],<--- The function 'vertices_set_processor_id' is never used.
int pid[],
size_t num_vtx,
MsqError& err )
{
if( pid_tag == 0 )
{
const char PROCESSOR_ID_NAME[] = "PROCESSOR_ID";
int default_pid = -1;
pid_tag = tag_create( PROCESSOR_ID_NAME, INT, 1, &default_pid, err );
// the 'INT' is the type of data to store
// the '1' is for one value per vertex
// NULL for no default value, if you want them all
// initialized to something, pass in a pointer to an int
// with the value.
MSQ_CHKERR( err );
}
tag_set_vertex_data( pid_tag, num_vtx, vert_array, pid, err );MSQ_CHKERR( err );
}
int ParallelMeshImpl::get_geometric_dimension( MsqError& err )
{
return myMesh->get_geometric_dimension( err );
}
void ParallelMeshImpl::get_all_elements( std::vector< ElementHandle >& elems, MsqError& err )
{
myMesh->get_all_elements( elems, err );
}
void ParallelMeshImpl::get_all_vertices( std::vector< VertexHandle >& verts, MsqError& err )
{
myMesh->get_all_vertices( verts, err );
}
void ParallelMeshImpl::vertices_get_fixed_flag( const VertexHandle vert_array[],
std::vector< bool >& flag_array,
size_t num_vtx,
MsqError& err )
{
myMesh->vertices_get_fixed_flag( vert_array, flag_array, num_vtx, err );
}
void ParallelMeshImpl::vertices_get_coordinates( const Mesh::VertexHandle vert_array[],
MsqVertex* coordinates,
size_t num_vtx,
MsqError& err )
{
myMesh->vertices_get_coordinates( vert_array, coordinates, num_vtx, err );
}
void ParallelMeshImpl::vertices_get_slaved_flag( const VertexHandle vert_array[],
std::vector< bool >& flag_array,
size_t num_vtx,
MsqError& err )
{
myMesh->vertices_get_slaved_flag( vert_array, flag_array, num_vtx, err );
}
void ParallelMeshImpl::vertex_set_coordinates( VertexHandle vertex, const Vector3D& coordinates, MsqError& err )
{
myMesh->vertex_set_coordinates( vertex, coordinates, err );
}
void ParallelMeshImpl::vertex_set_byte( VertexHandle vertex, unsigned char byte, MsqError& err )
{
myMesh->vertex_set_byte( vertex, byte, err );
}
void ParallelMeshImpl::vertices_set_byte( const VertexHandle* vert_array,
const unsigned char* byte_array,
size_t array_size,
MsqError& err )
{
myMesh->vertices_set_byte( vert_array, byte_array, array_size, err );
}
void ParallelMeshImpl::vertex_get_byte( const VertexHandle vertex, unsigned char* byte, MsqError& err )
{
myMesh->vertex_get_byte( vertex, byte, err );
}
void ParallelMeshImpl::vertices_get_byte( const VertexHandle* vert_array,
unsigned char* byte_array,
size_t array_size,
MsqError& err )
{
myMesh->vertices_get_byte( vert_array, byte_array, array_size, err );
}
void ParallelMeshImpl::vertices_get_attached_elements( const VertexHandle* vertices,
size_t num_vertices,
std::vector< ElementHandle >& elements,
std::vector< size_t >& offsets,
MsqError& err )
{
myMesh->vertices_get_attached_elements( vertices, num_vertices, elements, offsets, err );
}
void ParallelMeshImpl::elements_get_attached_vertices( const ElementHandle* elements,
size_t num_elems,
std::vector< VertexHandle >& vertices,
std::vector< size_t >& offsets,
MsqError& err )
{
myMesh->elements_get_attached_vertices( elements, num_elems, vertices, offsets, err );
}
void ParallelMeshImpl::elements_get_topologies( const ElementHandle* element_handle_array,
EntityTopology* element_topologies,
size_t num_elements,
MsqError& err )
{
myMesh->elements_get_topologies( element_handle_array, element_topologies, num_elements, err );
}
TagHandle ParallelMeshImpl::tag_create( const std::string& name,
TagType type,
unsigned length,
const void* defval,
MsqError& err )
{
return myMesh->tag_create( name, type, length, defval, err );
}
void ParallelMeshImpl::tag_delete( TagHandle handle, MsqError& err )
{
myMesh->tag_delete( handle, err );
}
TagHandle ParallelMeshImpl::tag_get( const std::string& name, MsqError& err )
{
return myMesh->tag_get( name, err );
}
void ParallelMeshImpl::tag_properties( TagHandle handle,
std::string& name,
TagType& type,
unsigned& length,
MsqError& err )
{
myMesh->tag_properties( handle, name, type, length, err );
}
void ParallelMeshImpl::tag_set_element_data( TagHandle handle,
size_t num_elems,
const ElementHandle* elem_array,
const void* values,
MsqError& err )
{
myMesh->tag_set_element_data( handle, num_elems, elem_array, values, err );
}
void ParallelMeshImpl::tag_get_element_data( TagHandle handle,
size_t num_elems,
const ElementHandle* elem_array,
void* values,
MsqError& err )
{
myMesh->tag_get_element_data( handle, num_elems, elem_array, values, err );
}
void ParallelMeshImpl::tag_set_vertex_data( TagHandle handle,
size_t num_verts,
const VertexHandle* vert_array,
const void* values,
MsqError& err )
{
myMesh->tag_set_vertex_data( handle, num_verts, vert_array, values, err );
}
void ParallelMeshImpl::tag_get_vertex_data( TagHandle handle,
size_t num_verts,
const VertexHandle* vert_array,
void* values,
MsqError& err )
{
myMesh->tag_get_vertex_data( handle, num_verts, vert_array, values, err );
}
void ParallelMeshImpl::release_entity_handles( const EntityHandle* handle_array, size_t num_handles, MsqError& err )
{
myMesh->release_entity_handles( handle_array, num_handles, err );
}
void ParallelMeshImpl::release()
{
myMesh->release();
}
} // namespace MBMesquite
|