42 namespace NekMeshUtils
47 return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
82 for (
int i = 1; i < all.num_elements() - 1; i++)
90 for (
int i = 2; i < all.num_elements() - 2; i++)
97 ASSERTL0(
false,
"Should not be able to pass vert");
106 switch (o->GetType())
110 bnds = boost::dynamic_pointer_cast<
CADCurve>(o)->Bounds();
111 for (
int i = 1; i < all.num_elements() - 1; i++)
119 bnds = boost::dynamic_pointer_cast<
CADSurf>(o)->GetBounds();
120 for (
int i = 2; i < all.num_elements() - 2; i++)
134 ASSERTL0(
false,
"Should not be able to pass vert");
143 switch (o->GetType())
147 bnds = boost::dynamic_pointer_cast<
CADCurve>(o)->Bounds();
148 for (
int i = 1; i < all.num_elements() - 1; i++)
156 bnds = boost::dynamic_pointer_cast<
CADSurf>(o)->GetBounds();
157 for (
int i = 2; i < all.num_elements() - 2; i++)
171 ASSERTL0(
false,
"Should not be able to pass vert");
180 if (o->GetType() ==
curve)
183 for (
int i = 0; i < xitst.num_elements(); i++)
185 val[i + 1] = xitst[i];
187 val[all.num_elements() - 1] = all[all.num_elements() - 1];
189 else if (o->GetType() ==
surf)
193 for (
int i = 0; i < xitst.num_elements(); i++)
195 val[i + 2] = xitst[i];
197 val[all.num_elements() - 2] = all[all.num_elements() - 2];
198 val[all.num_elements() - 1] = all[all.num_elements() - 1];
202 if (o->GetType() ==
curve)
206 for (
int i = 0; i < all.num_elements() - 1; i++)
210 dis[0] * dis[0] + dis[1] * dis[1] + dis[2] * dis[2];
211 ret += norm / (z[i + 1] - z[i]);
214 else if (o->GetType() ==
surf)
219 for (
int i = 0; i < val.num_elements() / 2; i++)
222 uv[i][0] = val[i * 2 + 0];
223 uv[i][1] = val[i * 2 + 1];
225 for (
int i = 0; i < uv.num_elements() - 1; i++)
229 dis[0] * dis[0] + dis[1] * dis[1] + dis[2] * dis[2];
230 ret += norm / (z[i + 1] - z[i]);
240 if (o->GetType() ==
curve)
243 for (
int i = 0; i < xitst.num_elements(); i++)
245 val[i + 1] = xitst[i];
247 val[all.num_elements() - 1] = all[all.num_elements() - 1];
249 else if (o->GetType() ==
surf)
253 for (
int i = 0; i < xitst.num_elements(); i++)
255 val[i + 2] = xitst[i];
257 val[all.num_elements() - 2] = all[all.num_elements() - 2];
258 val[all.num_elements() - 1] = all[all.num_elements() - 1];
263 if (o->GetType() ==
curve)
266 vector<Array<OneD, NekDouble> > r;
267 vector<Array<OneD, NekDouble> > dr;
269 for (
int i = 0; i < all.num_elements(); i++)
273 for (
int j = 0; j < 3; j++)
282 DNekMat J(all.num_elements() - 2, 1, 0.0);
283 for (
int i = 0; i < all.num_elements() - 2; i++)
286 2.0 / (z[i + 1] - z[i]) *
Dot(dr[i + 1],
Take(r[i + 1], r[i])) -
287 2.0 / (z[i + 2] - z[i + 1]) *
288 Dot(dr[i + 1],
Take(r[i + 2], r[i + 1]));
293 else if (o->GetType() ==
surf)
298 for (
int i = 0; i < val.num_elements() / 2; i++)
301 uv[i][0] = val[i * 2 + 0];
302 uv[i][1] = val[i * 2 + 1];
305 vector<Array<OneD, NekDouble> > r;
306 vector<Array<OneD, NekDouble> > dru, drv;
307 for (
int i = 0; i < uv.num_elements(); i++)
311 for (
int j = 0; j < 3; j++)
322 DNekMat J(2 * (uv.num_elements() - 2), 1, 0.0);
323 for (
int i = 0; i < uv.num_elements() - 2; i++)
325 J(2 * i + 0, 0) = 2.0 / (z[i + 1] - z[i]) *
326 Dot(dru[i + 1],
Take(r[i + 1], r[i])) +
327 2.0 / (z[i + 2] - z[i + 1]) *
328 Dot(dru[i + 1],
Take(r[i + 1], r[i + 2]));
330 J(2 * i + 1, 0) = 2.0 / (z[i + 1] - z[i]) *
331 Dot(drv[i + 1],
Take(r[i + 1], r[i])) +
332 2.0 / (z[i + 2] - z[i + 1]) *
333 Dot(drv[i + 1],
Take(r[i + 1], r[i + 2]));
344 if (o->GetType() ==
curve)
346 for (
int i = 0; i < xinew.num_elements(); i++)
348 all[i + 1] = xinew[i];
351 else if (o->GetType() ==
surf)
353 for (
int i = 0; i < xinew.num_elements(); i++)
355 all[i + 2] = xinew[i];
363 for (
int i = np - ni; i < np; i++)
365 ret[2 * (i - np + ni) + 0] = uv[i][0];
366 ret[2 * (i - np + ni) + 1] = uv[i][1];
375 for (
int i = np - ni; i < np; i++)
377 li[2 * (i - np + ni) + 0] = bnds[0];
378 li[2 * (i - np + ni) + 1] = bnds[2];
387 for (
int i = np - ni; i < np; i++)
389 ui[2 * (i - np + ni) + 0] = bnds[1];
390 ui[2 * (i - np + ni) + 1] = bnds[3];
398 for (
int i = np - ni; i < np; i++)
400 val[i][0] = xitst[(i - np + ni) * 2 + 0];
401 val[i][1] = xitst[(i - np + ni) * 2 + 1];
406 for (it = spring.begin(); it != spring.end(); it++)
409 Take(s->P(uv[(*it).first]), s->P(uv[(*it).second]));
410 NekDouble norm = dis[0] * dis[0] + dis[1] * dis[1] + dis[2] * dis[2];
411 ret += norm / z[(*it)];
420 for (
int i = np - ni; i < np; i++)
422 val[i][0] = xitst[(i - np + ni) * 2 + 0];
423 val[i][1] = xitst[(i - np + ni) * 2 + 1];
428 vector<Array<OneD, NekDouble> > r, dru, drv;
430 for (
int i = 0; i < val.num_elements(); i++)
434 for (
int i = 0; i < 3; i++)
445 for (
int i = 0; i < ni * 2; i++)
447 int var = floor(i / 2) + np - ni;
451 for (it = spring.begin(); it != spring.end();
456 if ((*it).first == var)
460 dr1 = dru[(*it).first];
464 dr1 = drv[(*it).first];
472 if ((*it).second == var)
476 dr2 = dru[(*it).second];
480 dr2 = drv[(*it).second];
490 Dot(
Take(r[(*it).first], r[(*it).second]),
Take(dr1, dr2));
498 for (
int i = np - ni; i < np; i++)
500 uv[i][0] = xinew[2 * (i - np + ni) + 0];
501 uv[i][1] = xinew[2 * (i - np + ni) + 1];
#define ASSERTL0(condition, msg)
Array< OneD, NekDouble > Take(Array< OneD, NekDouble > a, Array< OneD, NekDouble > b)
Array< OneD, NekDouble > Times(NekDouble t, Array< OneD, NekDouble > a)
NekDouble Dot(Array< OneD, NekDouble > a, Array< OneD, NekDouble > b)
class for handleing a cad surface
boost::shared_ptr< CADSurf > CADSurfSharedPtr
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
Array< OneD, NekDouble > Add(Array< OneD, NekDouble > a, Array< OneD, NekDouble > b)
boost::shared_ptr< CADCurve > CADCurveSharedPtr