47 int main(
int argc,
char** argv )
51 if( NULL == mbImpl )
return 1;
57 opts.
addOpt<
int >( string(
"nquads,n" ), string(
"Number of quads in the mesh (default = 1000" ), &nquads );
72 double def_val[3] = { 0.0, 0.0, 0.0 };
83 assert( count == (
int)quads.
size() );
85 double *x_ptr, *y_ptr, *z_ptr;
87 assert( count == (
int)verts.
size() );
89 double *tag1_ptr, *tag2_ptr;
92 assert( count == (
int)quads.
size() );
94 assert( count == (
int)quads.
size() );
96 assert( count == (
int)quads.
size() );
98 const vector< EntityHandle >** adjs_ptr;
100 assert( count == (
int)verts.
size() );
106 for(
int i = 0; i < nquads; i++ )
108 tag1_ptr[3 * i + 0] = tag1_ptr[3 * i + 1] = tag1_ptr[3 * i + 2] = 0.0;
109 for(
int j = 0; j < vpere; j++ )
111 int v_index = conn_ptr[vpere * i + j] - start_vert;
112 tag1_ptr[3 * i + 0] += x_ptr[v_index];
113 tag1_ptr[3 * i + 1] += y_ptr[v_index];
114 tag1_ptr[3 * i + 2] += z_ptr[v_index];
116 tag1_ptr[3 * i + 0] /= vpere;
117 tag1_ptr[3 * i + 1] /= vpere;
118 tag1_ptr[3 * i + 2] /= vpere;
123 for(
int v = 0; v < count; v++ )
125 const vector< EntityHandle >* avec = *( adjs_ptr + v );
126 for( vector< EntityHandle >::const_iterator ait = avec->begin(); ait != avec->end(); ++ait )
129 int a_ind = *ait - start_quad;
130 tag2_ptr[3 * a_ind + 0] += x_ptr[v];
131 tag2_ptr[3 * a_ind + 1] += y_ptr[v];
132 tag2_ptr[3 * a_ind + 2] += z_ptr[v];
142 int i = *q_it - start_quad;
143 for(
int j = 0; j < 3; j++ )
144 tag2_ptr[3 * i + j] /= (
double)tag3_ptr[i];
145 if( tag1_ptr[3 * i] != tag2_ptr[3 * i] || tag1_ptr[3 * i + 1] != tag2_ptr[3 * i + 1] ||
146 tag1_ptr[3 * i + 2] != tag2_ptr[3 * i + 2] )
148 cout <<
"Tag1, tag2 disagree for element " << *q_it + i << endl;
152 if( !n_dis ) cout <<
"All tags agree, success!" << endl;
166 vector< double* > coords;
173 for(
int i = 0; i < nquads; i++ )
175 coords[0][2 * i] = coords[0][2 * i + 1] = (double)i;
176 coords[1][2 * i] = 0.0;
177 coords[1][2 * i + 1] = 1.0;
178 coords[2][2 * i] = coords[2][2 * i + 1] = (double)0.0;
180 connect[4 * i + 0] = quad_v;
181 connect[4 * i + 1] = quad_v + 2;
182 connect[4 * i + 2] = quad_v + 3;
183 connect[4 * i + 3] = quad_v + 1;
188 coords[0][2 * nquads] = coords[0][2 * nquads + 1] = (double)nquads;
189 coords[1][2 * nquads] = 0.0;
190 coords[1][2 * nquads + 1] = 1.0;
191 coords[2][2 * nquads] = coords[2][2 * nquads + 1] = (double)0.0;
196 assert( !dum_range.
empty() );