55 int main(
int argc,
char** argv )
59 if( NULL == mbImpl )
return 1;
61 int nquads = 1000, nholes = 1;
65 opts.
addOpt<
int >( string(
"nquads,n" ), string(
"Number of quads in the mesh (default = 1000" ), &nquads );
66 opts.
addOpt<
int >( string(
"holes,H" ), string(
"Number of holes in the element handle space (default = 1" ),
69 if( nholes >= nquads )
71 cerr <<
"Number of holes needs to be < number of elements." << endl;
87 double def_val[3] = { 0.0, 0.0, 0.0 };
94 double *x_ptr, *y_ptr, *z_ptr, *tag1_ptr, *tag2_ptr;
108 assert( count == (
int)verts.
size() );
114 while( e_it != elems.
end() )
122 for(
int i = 0; i < count; i++ )
124 tag1_ptr[0] = tag1_ptr[1] = tag1_ptr[2] = 0.0;
125 for(
int j = 0; j < vpere; j++ )
127 int v_index = conn_ptr[j] - first_vert;
128 tag1_ptr[0] += x_ptr[v_index];
129 tag1_ptr[1] += y_ptr[v_index];
130 tag1_ptr[2] += z_ptr[v_index];
132 tag1_ptr[0] /= vpere;
133 tag1_ptr[1] /= vpere;
134 tag1_ptr[2] /= vpere;
154 map< EntityHandle, tag_struct > elem_map;
155 e_it = elems.
begin();
156 while( e_it != elems.
end() )
161 elem_map[*e_it] = ts;
169 const vector< EntityHandle >** adjs_ptr;
170 while( v_it != verts.
end() )
177 for(
int v = 0; v < count; v++ )
179 const vector< EntityHandle >* avec = *( adjs_ptr + v );
180 for( vector< EntityHandle >::const_iterator ait = avec->begin(); ait != avec->end(); ++ait )
185 map< EntityHandle, tag_struct >::iterator mit = elem_map.upper_bound( *ait );
188 int a_ind = *ait - ( *mit ).first;
190 ts.
avg_ptr[3 * a_ind + 0] += x_ptr[v];
191 ts.
avg_ptr[3 * a_ind + 1] += y_ptr[v];
192 ts.
avg_ptr[3 * a_ind + 2] += z_ptr[v];
202 e_it = elems.
begin();
203 while( e_it != elems.
end() )
212 for(
int i = 0; i < count; i++ )
214 for(
int j = 0; j < 3; j++ )
215 tag2_ptr[3 * i + j] /= (
double)tag3_ptr[i];
216 if( tag1_ptr[3 * i] != tag2_ptr[3 * i] || tag1_ptr[3 * i + 1] != tag2_ptr[3 * i + 1] ||
217 tag1_ptr[3 * i + 2] != tag2_ptr[3 * i + 2] )
218 cout <<
"Tag1, tag2 disagree for element " << *e_it + i << endl;
236 vector< double* > coords;
243 for(
int i = 0; i < nquads; i++ )
245 coords[0][2 * i] = coords[0][2 * i + 1] = (double)i;
246 coords[1][2 * i] = 0.0;
247 coords[1][2 * i + 1] = 1.0;
248 coords[2][2 * i] = coords[2][2 * i + 1] = (double)0.0;
250 for(
int j = 0; j < 4; j++ )
251 connect[4 * i + j] = quad_v + j;
255 coords[0][2 * nquads] = coords[0][2 * nquads + 1] = (double)nquads;
256 coords[1][2 * nquads] = 0.0;
257 coords[1][2 * nquads + 1] = 1.0;
258 coords[2][2 * nquads] = coords[2][2 * nquads + 1] = (double)0.0;
262 int de = nquads / ( nholes + 1 );
263 for(
int i = 0; i < nholes; i++ )