VTK-m  2.0
TypeOfCellHexahedral.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 // This software is distributed WITHOUT ANY WARRANTY; without even
6 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
7 // PURPOSE. See the above copyright notice for more information.
8 //
9 // Copyright 2018 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
10 // Copyright 2018 UT-Battelle, LLC.
11 // Copyright 2018 Los Alamos National Security.
12 //
13 // Under the terms of Contract DE-NA0003525 with NTESS,
14 // the U.S. Government retains certain rights in this software.
15 //
16 // Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
17 // Laboratory (LANL), the U.S. Government retains certain rights in
18 // this software.
19 //============================================================================
20 #ifndef vtk_m_worklet_cellmetrics_TypeOfCellHexahedral
21 #define vtk_m_worklet_cellmetrics_TypeOfCellHexahedral
22 
35 #include <vtkm/Math.h>
36 #include <vtkm/VectorAnalysis.h>
37 
44 template <typename Scalar, typename Vector, typename CollectionOfPoints>
45 VTKM_EXEC Vector GetHexL0(const CollectionOfPoints& pts)
46 {
47  const Vector L0(pts[1] - pts[0]);
48  return L0;
49 }
50 
57 template <typename Scalar, typename Vector, typename CollectionOfPoints>
58 VTKM_EXEC Vector GetHexL1(const CollectionOfPoints& pts)
59 {
60  const Vector L1(pts[2] - pts[1]);
61  return L1;
62 }
63 
70 template <typename Scalar, typename Vector, typename CollectionOfPoints>
71 VTKM_EXEC Vector GetHexL2(const CollectionOfPoints& pts)
72 {
73  const Vector L2(pts[3] - pts[2]);
74  return L2;
75 }
76 
83 template <typename Scalar, typename Vector, typename CollectionOfPoints>
84 VTKM_EXEC Vector GetHexL3(const CollectionOfPoints& pts)
85 {
86  const Vector L3(pts[3] - pts[0]);
87  return L3;
88 }
89 
96 template <typename Scalar, typename Vector, typename CollectionOfPoints>
97 VTKM_EXEC Vector GetHexL4(const CollectionOfPoints& pts)
98 {
99  const Vector L4(pts[4] - pts[0]);
100  return L4;
101 }
102 
109 template <typename Scalar, typename Vector, typename CollectionOfPoints>
110 VTKM_EXEC Vector GetHexL5(const CollectionOfPoints& pts)
111 {
112  const Vector L5(pts[5] - pts[1]);
113  return L5;
114 }
115 
122 template <typename Scalar, typename Vector, typename CollectionOfPoints>
123 VTKM_EXEC Vector GetHexL6(const CollectionOfPoints& pts)
124 {
125  const Vector L6(pts[6] - pts[2]);
126  return L6;
127 }
128 
135 template <typename Scalar, typename Vector, typename CollectionOfPoints>
136 VTKM_EXEC Vector GetHexL7(const CollectionOfPoints& pts)
137 {
138  const Vector L7(pts[7] - pts[3]);
139  return L7;
140 }
141 
148 template <typename Scalar, typename Vector, typename CollectionOfPoints>
149 VTKM_EXEC Vector GetHexL8(const CollectionOfPoints& pts)
150 {
151  const Vector L8(pts[5] - pts[4]);
152  return L8;
153 }
154 
161 template <typename Scalar, typename Vector, typename CollectionOfPoints>
162 VTKM_EXEC Vector GetHexL9(const CollectionOfPoints& pts)
163 {
164  const Vector L9(pts[6] - pts[5]);
165  return L9;
166 }
167 
174 template <typename Scalar, typename Vector, typename CollectionOfPoints>
175 VTKM_EXEC Vector GetHexL10(const CollectionOfPoints& pts)
176 {
177  const Vector L10(pts[7] - pts[6]);
178  return L10;
179 }
186 template <typename Scalar, typename Vector, typename CollectionOfPoints>
187 VTKM_EXEC Vector GetHexL11(const CollectionOfPoints& pts)
188 {
189  const Vector L11(pts[7] - pts[4]);
190  return L11;
191 }
198 template <typename Scalar, typename Vector, typename CollectionOfPoints>
199 VTKM_EXEC Scalar GetHexL0Magnitude(const CollectionOfPoints& pts)
200 {
201  const Scalar l0 = static_cast<Scalar>(
202  vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL0<Scalar, Vector, CollectionOfPoints>(pts))));
203  return l0;
204 }
211 template <typename Scalar, typename Vector, typename CollectionOfPoints>
212 VTKM_EXEC Scalar GetHexL1Magnitude(const CollectionOfPoints& pts)
213 {
214  const Scalar l1 = static_cast<Scalar>(
215  vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL1<Scalar, Vector, CollectionOfPoints>(pts))));
216  return l1;
217 }
224 template <typename Scalar, typename Vector, typename CollectionOfPoints>
225 VTKM_EXEC Scalar GetHexL2Magnitude(const CollectionOfPoints& pts)
226 {
227  const Scalar l2 = static_cast<Scalar>(
228  vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL2<Scalar, Vector, CollectionOfPoints>(pts))));
229  return l2;
230 }
237 template <typename Scalar, typename Vector, typename CollectionOfPoints>
238 VTKM_EXEC Scalar GetHexL3Magnitude(const CollectionOfPoints& pts)
239 {
240  const Scalar l3 = static_cast<Scalar>(
241  vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL3<Scalar, Vector, CollectionOfPoints>(pts))));
242  return l3;
243 }
250 template <typename Scalar, typename Vector, typename CollectionOfPoints>
251 VTKM_EXEC Scalar GetHexL4Magnitude(const CollectionOfPoints& pts)
252 {
253  const Scalar l4 = static_cast<Scalar>(
254  vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL4<Scalar, Vector, CollectionOfPoints>(pts))));
255  return l4;
256 }
263 template <typename Scalar, typename Vector, typename CollectionOfPoints>
264 VTKM_EXEC Scalar GetHexL5Magnitude(const CollectionOfPoints& pts)
265 {
266  const Scalar l5 = static_cast<Scalar>(
267  vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL5<Scalar, Vector, CollectionOfPoints>(pts))));
268  return l5;
269 }
276 template <typename Scalar, typename Vector, typename CollectionOfPoints>
277 VTKM_EXEC Scalar GetHexL6Magnitude(const CollectionOfPoints& pts)
278 {
279  const Scalar l6 = static_cast<Scalar>(
280  vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL6<Scalar, Vector, CollectionOfPoints>(pts))));
281  return l6;
282 }
289 template <typename Scalar, typename Vector, typename CollectionOfPoints>
290 VTKM_EXEC Scalar GetHexL7Magnitude(const CollectionOfPoints& pts)
291 {
292  const Scalar l7 = static_cast<Scalar>(
293  vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL7<Scalar, Vector, CollectionOfPoints>(pts))));
294  return l7;
295 }
302 template <typename Scalar, typename Vector, typename CollectionOfPoints>
303 VTKM_EXEC Scalar GetHexL8Magnitude(const CollectionOfPoints& pts)
304 {
305  const Scalar l8 = static_cast<Scalar>(
306  vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL8<Scalar, Vector, CollectionOfPoints>(pts))));
307  return l8;
308 }
315 template <typename Scalar, typename Vector, typename CollectionOfPoints>
316 VTKM_EXEC Scalar GetHexL9Magnitude(const CollectionOfPoints& pts)
317 {
318  const Scalar l9 = static_cast<Scalar>(
319  vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL9<Scalar, Vector, CollectionOfPoints>(pts))));
320  return l9;
321 }
328 template <typename Scalar, typename Vector, typename CollectionOfPoints>
329 VTKM_EXEC Scalar GetHexL10Magnitude(const CollectionOfPoints& pts)
330 {
331  const Scalar l10 = static_cast<Scalar>(
332  vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL10<Scalar, Vector, CollectionOfPoints>(pts))));
333  return l10;
334 }
341 template <typename Scalar, typename Vector, typename CollectionOfPoints>
342 VTKM_EXEC Scalar GetHexL11Magnitude(const CollectionOfPoints& pts)
343 {
344  const Scalar l11 = static_cast<Scalar>(
345  vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL11<Scalar, Vector, CollectionOfPoints>(pts))));
346  return l11;
347 }
354 template <typename Scalar, typename Vector, typename CollectionOfPoints>
355 VTKM_EXEC Scalar GetHexLMax(const CollectionOfPoints& pts)
356 {
357  const Scalar l0 = GetHexL0Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
358  const Scalar l1 = GetHexL1Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
359  const Scalar l2 = GetHexL2Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
360  const Scalar l3 = GetHexL3Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
361  const Scalar l4 = GetHexL4Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
362  const Scalar l5 = GetHexL5Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
363  const Scalar l6 = GetHexL6Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
364  const Scalar l7 = GetHexL7Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
365  const Scalar l8 = GetHexL8Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
366  const Scalar l9 = GetHexL9Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
367  const Scalar l10 = GetHexL10Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
368  const Scalar l11 = GetHexL11Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
369 
370  const Scalar lmax = vtkm::Max(
371  l0,
372  vtkm::Max(
373  l1,
374  vtkm::Max(
375  l2,
376  vtkm::Max(
377  l3,
378  vtkm::Max(
379  l4,
380  vtkm::Max(
381  l5,
382  vtkm::Max(l6, vtkm::Max(l7, vtkm::Max(l8, vtkm::Max(l9, vtkm::Max(l10, l11)))))))))));
383 
384  return lmax;
385 }
386 
393 template <typename Scalar, typename Vector, typename CollectionOfPoints>
394 VTKM_EXEC Scalar GetHexLMin(const CollectionOfPoints& pts)
395 {
396  const Scalar l0 = GetHexL0Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
397  const Scalar l1 = GetHexL1Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
398  const Scalar l2 = GetHexL2Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
399  const Scalar l3 = GetHexL3Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
400  const Scalar l4 = GetHexL4Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
401  const Scalar l5 = GetHexL5Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
402  const Scalar l6 = GetHexL6Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
403  const Scalar l7 = GetHexL7Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
404  const Scalar l8 = GetHexL8Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
405  const Scalar l9 = GetHexL9Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
406  const Scalar l10 = GetHexL10Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
407  const Scalar l11 = GetHexL11Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
408 
409  const Scalar lmin = vtkm::Min(
410  l0,
411  vtkm::Min(
412  l1,
413  vtkm::Min(
414  l2,
415  vtkm::Min(
416  l3,
417  vtkm::Min(
418  l4,
419  vtkm::Min(
420  l5,
421  vtkm::Min(l6, vtkm::Min(l7, vtkm::Min(l8, vtkm::Min(l9, vtkm::Min(l10, l11)))))))))));
422 
423  return lmin;
424 }
425 
432 template <typename Scalar, typename Vector, typename CollectionOfPoints>
433 VTKM_EXEC Vector GetHexD0(const CollectionOfPoints& pts)
434 {
435  const Vector D0((pts[6] - pts[0]));
436  return D0;
437 }
438 
445 template <typename Scalar, typename Vector, typename CollectionOfPoints>
446 VTKM_EXEC Vector GetHexD1(const CollectionOfPoints& pts)
447 {
448  const Vector D1(pts[7] - pts[1]);
449  return D1;
450 }
451 
458 template <typename Scalar, typename Vector, typename CollectionOfPoints>
459 VTKM_EXEC Vector GetHexD2(const CollectionOfPoints& pts)
460 {
461  const Vector D2(pts[4] - pts[2]);
462  return D2;
463 }
464 
471 template <typename Scalar, typename Vector, typename CollectionOfPoints>
472 VTKM_EXEC Vector GetHexD3(const CollectionOfPoints& pts)
473 {
474  const Vector D3(pts[5] - pts[3]);
475  return D3;
476 }
477 
484 template <typename Scalar, typename Vector, typename CollectionOfPoints>
485 VTKM_EXEC Scalar GetHexD0Magnitude(const CollectionOfPoints& pts)
486 {
487  const Scalar d0 = static_cast<Scalar>(
488  vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexD0<Scalar, Vector, CollectionOfPoints>(pts))));
489  return d0;
490 }
491 
498 template <typename Scalar, typename Vector, typename CollectionOfPoints>
499 VTKM_EXEC Scalar GetHexD1Magnitude(const CollectionOfPoints& pts)
500 {
501  const Scalar d1 = static_cast<Scalar>(
502  vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexD1<Scalar, Vector, CollectionOfPoints>(pts))));
503  return d1;
504 }
505 
512 template <typename Scalar, typename Vector, typename CollectionOfPoints>
513 VTKM_EXEC Scalar GetHexD2Magnitude(const CollectionOfPoints& pts)
514 {
515  const Scalar d2 = static_cast<Scalar>(
516  vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexD2<Scalar, Vector, CollectionOfPoints>(pts))));
517  return d2;
518 }
519 
526 template <typename Scalar, typename Vector, typename CollectionOfPoints>
527 VTKM_EXEC Scalar GetHexD3Magnitude(const CollectionOfPoints& pts)
528 {
529  const Scalar d3 = static_cast<Scalar>(
530  vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexD3<Scalar, Vector, CollectionOfPoints>(pts))));
531  return d3;
532 }
533 
540 template <typename Scalar, typename Vector, typename CollectionOfPoints>
541 VTKM_EXEC Scalar GetHexDMin(const CollectionOfPoints& pts)
542 {
543  const Scalar d0 = GetHexD0Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
544  const Scalar d1 = GetHexD1Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
545  const Scalar d2 = GetHexD2Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
546  const Scalar d3 = GetHexD3Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
547 
548  const Scalar dmin = vtkm::Min(d0, vtkm::Min(d1, vtkm::Min(d2, d3)));
549 
550  return dmin;
551 }
552 
559 template <typename Scalar, typename Vector, typename CollectionOfPoints>
560 VTKM_EXEC Scalar GetHexDMax(const CollectionOfPoints& pts)
561 {
562  const Scalar d0 = GetHexD0Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
563  const Scalar d1 = GetHexD1Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
564  const Scalar d2 = GetHexD2Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
565  const Scalar d3 = GetHexD3Magnitude<Scalar, Vector, CollectionOfPoints>(pts);
566 
567  const Scalar dmax = vtkm::Max(d0, vtkm::Max(d1, vtkm::Max(d2, d3)));
568 
569  return dmax;
570 }
571 
578 template <typename Scalar, typename Vector, typename CollectionOfPoints>
579 VTKM_EXEC Vector GetHexX1(const CollectionOfPoints& pts)
580 {
581  const Vector X1((pts[1] - pts[0]) + (pts[2] - pts[3]) + (pts[5] - pts[4]) + (pts[6] - pts[7]));
582  return X1;
583 }
584 
591 template <typename Scalar, typename Vector, typename CollectionOfPoints>
592 VTKM_EXEC Vector GetHexX2(const CollectionOfPoints& pts)
593 {
594  const Vector X2((pts[3] - pts[0]) + (pts[2] - pts[1]) + (pts[7] - pts[4]) + (pts[6] - pts[5]));
595  return X2;
596 }
597 
604 template <typename Scalar, typename Vector, typename CollectionOfPoints>
605 VTKM_EXEC Vector GetHexX3(const CollectionOfPoints& pts)
606 {
607  const Vector X3((pts[4] - pts[0]) + (pts[5] - pts[1]) + (pts[6] - pts[2]) + (pts[7] - pts[3]));
608  return X3;
609 }
610 
618 template <typename Scalar, typename Vector, typename CollectionOfPoints>
619 VTKM_EXEC vtkm::Vec<Vector, 3> GetHexAi(const CollectionOfPoints& pts, const vtkm::Id& index)
620 {
621  const Scalar neg1(-1.0);
622  if (index == 0)
623  {
624  const Vector v0 = GetHexL0<Scalar, Vector, CollectionOfPoints>(pts);
625  const Vector v1 = GetHexL3<Scalar, Vector, CollectionOfPoints>(pts);
626  const Vector v2 = GetHexL4<Scalar, Vector, CollectionOfPoints>(pts);
627  const vtkm::Vec<Vector, 3> A = { v0, v1, v2 };
628  return A;
629  }
630  else if (index == 1)
631  {
632  const Vector v0 = GetHexL1<Scalar, Vector, CollectionOfPoints>(pts);
633  const Vector v1 = neg1 * GetHexL0<Scalar, Vector, CollectionOfPoints>(pts);
634  const Vector v2 = GetHexL5<Scalar, Vector, CollectionOfPoints>(pts);
635  const vtkm::Vec<Vector, 3> A = { v0, v1, v2 };
636  return A;
637  }
638  else if (index == 2)
639  {
640  const Vector v0 = GetHexL2<Scalar, Vector, CollectionOfPoints>(pts);
641  const Vector v1 = neg1 * GetHexL1<Scalar, Vector, CollectionOfPoints>(pts);
642  const Vector v2 = GetHexL6<Scalar, Vector, CollectionOfPoints>(pts);
643  const vtkm::Vec<Vector, 3> A = { v0, v1, v2 };
644  return A;
645  }
646  else if (index == 3)
647  {
648  const Vector v0 = neg1 * GetHexL3<Scalar, Vector, CollectionOfPoints>(pts);
649  const Vector v1 = neg1 * GetHexL2<Scalar, Vector, CollectionOfPoints>(pts);
650  const Vector v2 = GetHexL7<Scalar, Vector, CollectionOfPoints>(pts);
651  const vtkm::Vec<Vector, 3> A = { v0, v1, v2 };
652  return A;
653  }
654  else if (index == 4)
655  {
656  const Vector v0 = GetHexL11<Scalar, Vector, CollectionOfPoints>(pts);
657  const Vector v1 = GetHexL8<Scalar, Vector, CollectionOfPoints>(pts);
658  const Vector v2 = neg1 * GetHexL4<Scalar, Vector, CollectionOfPoints>(pts);
659  const vtkm::Vec<Vector, 3> A = { v0, v1, v2 };
660  return A;
661  }
662  else if (index == 5)
663  {
664  const Vector v0 = neg1 * GetHexL8<Scalar, Vector, CollectionOfPoints>(pts);
665  const Vector v1 = GetHexL9<Scalar, Vector, CollectionOfPoints>(pts);
666  const Vector v2 = neg1 * GetHexL5<Scalar, Vector, CollectionOfPoints>(pts);
667  const vtkm::Vec<Vector, 3> A = { v0, v1, v2 };
668  return A;
669  }
670  else if (index == 6)
671  {
672  const Vector v0 = neg1 * GetHexL9<Scalar, Vector, CollectionOfPoints>(pts);
673  const Vector v1 = GetHexL10<Scalar, Vector, CollectionOfPoints>(pts);
674  const Vector v2 = neg1 * GetHexL6<Scalar, Vector, CollectionOfPoints>(pts);
675  const vtkm::Vec<Vector, 3> A = { v0, v1, v2 };
676  return A;
677  }
678  else if (index == 7)
679  {
680  const Vector v0 = neg1 * GetHexL10<Scalar, Vector, CollectionOfPoints>(pts);
681  const Vector v1 = neg1 * GetHexL11<Scalar, Vector, CollectionOfPoints>(pts);
682  const Vector v2 = neg1 * GetHexL7<Scalar, Vector, CollectionOfPoints>(pts);
683  const vtkm::Vec<Vector, 3> A = { v0, v1, v2 };
684  return A;
685  }
686  else
687  {
688  const Vector v0 = GetHexX1<Scalar, Vector, CollectionOfPoints>(pts);
689  const Vector v1 = GetHexX2<Scalar, Vector, CollectionOfPoints>(pts);
690  const Vector v2 = GetHexX3<Scalar, Vector, CollectionOfPoints>(pts);
691  const vtkm::Vec<Vector, 3> A = { v0, v1, v2 };
692  return A;
693  }
694 }
695 
703 template <typename Scalar, typename Vector, typename CollectionOfPoints>
704 VTKM_EXEC Scalar GetHexAiNormSquared(const CollectionOfPoints& pts, const vtkm::Id& index)
705 {
706  const vtkm::Vec<Vector, 3> Ai = GetHexAi<Scalar, Vector, CollectionOfPoints>(pts, index);
707  const Scalar magSquared0 = static_cast<Scalar>(vtkm::MagnitudeSquared(Ai[0]));
708  const Scalar magSquared1 = static_cast<Scalar>(vtkm::MagnitudeSquared(Ai[1]));
709  const Scalar magSquared2 = static_cast<Scalar>(vtkm::MagnitudeSquared(Ai[2]));
710 
711  const Scalar AiNormSquared = magSquared0 + magSquared1 + magSquared2;
712 
713  return AiNormSquared;
714 }
715 
723 template <typename Scalar, typename Vector, typename CollectionOfPoints>
724 VTKM_EXEC Scalar GetHexAiAdjNormSquared(const CollectionOfPoints& pts, const vtkm::Id& index)
725 {
726  const vtkm::Vec<Vector, 3> Ai = GetHexAi<Scalar, Vector, CollectionOfPoints>(pts, index);
727  const Scalar magSquared0 = static_cast<Scalar>(vtkm::MagnitudeSquared(vtkm::Cross(Ai[0], Ai[1])));
728  const Scalar magSquared1 = static_cast<Scalar>(vtkm::MagnitudeSquared(vtkm::Cross(Ai[1], Ai[2])));
729  const Scalar magSquared2 = static_cast<Scalar>(vtkm::MagnitudeSquared(vtkm::Cross(Ai[2], Ai[0])));
730 
731  const Scalar AiAdjNormSquared = magSquared0 + magSquared1 + magSquared2;
732 
733  return AiAdjNormSquared;
734 }
735 
743 template <typename Scalar, typename Vector, typename CollectionOfPoints>
744 VTKM_EXEC Scalar GetHexAlphai(const CollectionOfPoints& pts, const vtkm::Id& index)
745 {
746  const vtkm::Vec<Vector, 3> Ai = GetHexAi<Scalar, Vector, CollectionOfPoints>(pts, index);
747  const Scalar alpha_i = static_cast<Scalar>(vtkm::Dot(Ai[0], vtkm::Cross(Ai[1], Ai[2])));
748 
749  return alpha_i;
750 }
751 
759 template <typename Scalar, typename Vector, typename CollectionOfPoints>
760 VTKM_EXEC vtkm::Vec<Vector, 3> GetHexAiHat(const CollectionOfPoints& pts, const vtkm::Id& index)
761 {
762  const vtkm::Vec<Vector, 3> Ai = GetHexAi<Scalar, Vector, CollectionOfPoints>(pts, index);
763  const Vector v0hat = Ai[0] / vtkm::Sqrt(vtkm::MagnitudeSquared(Ai[0]));
764  const Vector v1hat = Ai[1] / vtkm::Sqrt(vtkm::MagnitudeSquared(Ai[1]));
765  const Vector v2hat = Ai[2] / vtkm::Sqrt(vtkm::MagnitudeSquared(Ai[2]));
766 
767  const vtkm::Vec<Vector, 3> Ahat = { v0hat, v1hat, v2hat };
768  return Ahat;
769 }
777 template <typename Scalar, typename Vector, typename CollectionOfPoints>
778 VTKM_EXEC Scalar GetHexAlphaiHat(const CollectionOfPoints& pts, const vtkm::Id& index)
779 {
780  const vtkm::Vec<Vector, 3> Ai = GetHexAiHat<Scalar, Vector, CollectionOfPoints>(pts, index);
781  const Scalar hatAlpha_i = static_cast<Scalar>(vtkm::Dot(Ai[0], vtkm::Cross(Ai[1], Ai[2])));
782 
783  return hatAlpha_i;
784 }
785 #endif
GetHexX2
VTKM_EXEC Vector GetHexX2(const CollectionOfPoints &pts)
Returns the X2 vector defined in the verdict manual.
Definition: TypeOfCellHexahedral.h:592
vtkm::Sqrt
VTKM_EXEC_CONT vtkm::Float32 Sqrt(vtkm::Float32 x)
Compute the square root of x.
Definition: Math.h:958
GetHexL2
VTKM_EXEC Vector GetHexL2(const CollectionOfPoints &pts)
Returns the L2 vector, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:71
vtkm::MagnitudeSquared
VTKM_EXEC_CONT detail::FloatingPointReturnType< T >::Type MagnitudeSquared(const T &x)
Returns the square of the magnitude of a vector.
Definition: VectorAnalysis.h:64
GetHexL1Magnitude
VTKM_EXEC Scalar GetHexL1Magnitude(const CollectionOfPoints &pts)
Returns the L1 vector's magnitude, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:212
GetHexD2
VTKM_EXEC Vector GetHexD2(const CollectionOfPoints &pts)
Returns the D2 vector, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:459
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
GetHexAiNormSquared
VTKM_EXEC Scalar GetHexAiNormSquared(const CollectionOfPoints &pts, const vtkm::Id &index)
Returns ||A_i||^2 as defined in the verdict manual.
Definition: TypeOfCellHexahedral.h:704
GetHexL6
VTKM_EXEC Vector GetHexL6(const CollectionOfPoints &pts)
Returns the L6 vector, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:123
GetHexL10Magnitude
VTKM_EXEC Scalar GetHexL10Magnitude(const CollectionOfPoints &pts)
Returns the L10 vector's magnitude, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:329
GetHexL7
VTKM_EXEC Vector GetHexL7(const CollectionOfPoints &pts)
Returns the L7 vector, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:136
GetHexL3Magnitude
VTKM_EXEC Scalar GetHexL3Magnitude(const CollectionOfPoints &pts)
Returns the L3 vector's magnitude, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:238
GetHexL9
VTKM_EXEC Vector GetHexL9(const CollectionOfPoints &pts)
Returns the L9 vector, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:162
GetHexX3
VTKM_EXEC Vector GetHexX3(const CollectionOfPoints &pts)
Returns the X3 vector defined in the verdict manual.
Definition: TypeOfCellHexahedral.h:605
GetHexL3
VTKM_EXEC Vector GetHexL3(const CollectionOfPoints &pts)
Returns the L3 vector, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:84
GetHexL2Magnitude
VTKM_EXEC Scalar GetHexL2Magnitude(const CollectionOfPoints &pts)
Returns the L2 vector's magnitude, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:225
GetHexD3Magnitude
VTKM_EXEC Scalar GetHexD3Magnitude(const CollectionOfPoints &pts)
Returns the D3 vector's magnitude, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:527
GetHexL10
VTKM_EXEC Vector GetHexL10(const CollectionOfPoints &pts)
Returns the L10 vector, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:175
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
VectorAnalysis.h
GetHexL0
VTKM_EXEC Vector GetHexL0(const CollectionOfPoints &pts)
The Verdict manual defines a set of commonly used components of a hexahedra (hex).
Definition: TypeOfCellHexahedral.h:45
GetHexAlphai
VTKM_EXEC Scalar GetHexAlphai(const CollectionOfPoints &pts, const vtkm::Id &index)
Returns alpha_i, the determinant of A_i, as defined in the verdict manual.
Definition: TypeOfCellHexahedral.h:744
GetHexD1Magnitude
VTKM_EXEC Scalar GetHexD1Magnitude(const CollectionOfPoints &pts)
Returns the D1 vector's magnitude, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:499
GetHexL5
VTKM_EXEC Vector GetHexL5(const CollectionOfPoints &pts)
Returns the L5 vector, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:110
GetHexD1
VTKM_EXEC Vector GetHexD1(const CollectionOfPoints &pts)
Returns the D1 vector, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:446
Math.h
GetHexL9Magnitude
VTKM_EXEC Scalar GetHexL9Magnitude(const CollectionOfPoints &pts)
Returns the L9 vector's magnitude, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:316
GetHexD2Magnitude
VTKM_EXEC Scalar GetHexD2Magnitude(const CollectionOfPoints &pts)
Returns the D2 vector's magnitude, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:513
GetHexL0Magnitude
VTKM_EXEC Scalar GetHexL0Magnitude(const CollectionOfPoints &pts)
Returns the L0 vector's magnitude, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:199
vtkm::Cross
VTKM_EXEC_CONT vtkm::Vec< typename detail::FloatingPointReturnType< T >::Type, 3 > Cross(const vtkm::Vec< T, 3 > &x, const vtkm::Vec< T, 3 > &y)
Find the cross product of two vectors.
Definition: VectorAnalysis.h:177
GetHexDMax
VTKM_EXEC Scalar GetHexDMax(const CollectionOfPoints &pts)
Returns the Min of the magnitude of each vector which makes up the sides of the Hex.
Definition: TypeOfCellHexahedral.h:560
GetHexL7Magnitude
VTKM_EXEC Scalar GetHexL7Magnitude(const CollectionOfPoints &pts)
Returns the L7 vector's magnitude, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:290
GetHexLMax
VTKM_EXEC Scalar GetHexLMax(const CollectionOfPoints &pts)
Returns the Max of the magnitude of each vector which makes up the sides of the Hex.
Definition: TypeOfCellHexahedral.h:355
GetHexLMin
VTKM_EXEC Scalar GetHexLMin(const CollectionOfPoints &pts)
Returns the Min of the magnitude of each vector which makes up the sides of the Hex.
Definition: TypeOfCellHexahedral.h:394
GetHexD0Magnitude
VTKM_EXEC Scalar GetHexD0Magnitude(const CollectionOfPoints &pts)
Returns the D0 vector's magnitude, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:485
GetHexL8
VTKM_EXEC Vector GetHexL8(const CollectionOfPoints &pts)
Returns the L8 vector, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:149
GetHexL4Magnitude
VTKM_EXEC Scalar GetHexL4Magnitude(const CollectionOfPoints &pts)
Returns the L4 vector's magnitude, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:251
GetHexL6Magnitude
VTKM_EXEC Scalar GetHexL6Magnitude(const CollectionOfPoints &pts)
Returns the L6 vector's magnitude, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:277
GetHexL11
VTKM_EXEC Vector GetHexL11(const CollectionOfPoints &pts)
Returns the L11 vector, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:187
GetHexAiHat
VTKM_EXEC vtkm::Vec< Vector, 3 > GetHexAiHat(const CollectionOfPoints &pts, const vtkm::Id &index)
Returns hat{A}_i, the "normalized" version of A_i, as defined in the verdict manual.
Definition: TypeOfCellHexahedral.h:760
vtkm::Vec
A short fixed-length array.
Definition: Types.h:767
GetHexX1
VTKM_EXEC Vector GetHexX1(const CollectionOfPoints &pts)
Returns the X1 vector defined in the verdict manual.
Definition: TypeOfCellHexahedral.h:579
GetHexD3
VTKM_EXEC Vector GetHexD3(const CollectionOfPoints &pts)
Returns the D3 vector, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:472
GetHexL4
VTKM_EXEC Vector GetHexL4(const CollectionOfPoints &pts)
Returns the L4 vector, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:97
GetHexD0
VTKM_EXEC Vector GetHexD0(const CollectionOfPoints &pts)
Returns the D0 vector, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:433
GetHexL5Magnitude
VTKM_EXEC Scalar GetHexL5Magnitude(const CollectionOfPoints &pts)
Returns the L5 vector's magnitude, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:264
GetHexAi
VTKM_EXEC vtkm::Vec< Vector, 3 > GetHexAi(const CollectionOfPoints &pts, const vtkm::Id &index)
Returns the A_i matrix defined in the verdict manual.
Definition: TypeOfCellHexahedral.h:619
GetHexL1
VTKM_EXEC Vector GetHexL1(const CollectionOfPoints &pts)
Returns the L1 vector, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:58
GetHexL11Magnitude
VTKM_EXEC Scalar GetHexL11Magnitude(const CollectionOfPoints &pts)
Returns the L11 vector's magnitude, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:342
GetHexAiAdjNormSquared
VTKM_EXEC Scalar GetHexAiAdjNormSquared(const CollectionOfPoints &pts, const vtkm::Id &index)
Returns ||adj(A_i)||^2 as defined in the verdict manual.
Definition: TypeOfCellHexahedral.h:724
GetHexDMin
VTKM_EXEC Scalar GetHexDMin(const CollectionOfPoints &pts)
Returns the Min of the magnitude of each vector which makes up the sides of the Hex.
Definition: TypeOfCellHexahedral.h:541
GetHexL8Magnitude
VTKM_EXEC Scalar GetHexL8Magnitude(const CollectionOfPoints &pts)
Returns the L8 vector's magnitude, as defined by the verdict manual.
Definition: TypeOfCellHexahedral.h:303
GetHexAlphaiHat
VTKM_EXEC Scalar GetHexAlphaiHat(const CollectionOfPoints &pts, const vtkm::Id &index)
Returns hat{alpha}_i, the determinant of hat{A}_i, as defined in the verdict manual.
Definition: TypeOfCellHexahedral.h:778