Merge topic 'mir-float-fix'

ae98d4f25 Fixing dashboard warnings
a0a333949 Fixing dashboard warnings
d3756d8ef Fixing dashboard warnings
397ffaad2 Fixing dashboard warnings
7f2badfce Fixing dashboard warnings
4db0cecc1 Fixing dashboard warnings
8ddcad824 Fixing dashboard warnings
7d10b4f32 Adding assert to unit test
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2674
This commit is contained in:
Abhishek Yenpure 2022-02-02 16:48:13 +00:00 committed by Kitware Robot
commit 53651c82bf
25 changed files with 435 additions and 280 deletions

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d68d7acc1199af1de37ff581c6e39309e99dc0bae977fc9a0abf054d80aeb52a
size 2004559

@ -101,6 +101,12 @@ VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts,
pts[0] - pts[3],
};
if (vtkm::MagnitudeSquared(edges[0]) == OutType(0.0) ||
vtkm::MagnitudeSquared(edges[1]) == OutType(0.0) ||
vtkm::MagnitudeSquared(edges[2]) == OutType(0.0) ||
vtkm::MagnitudeSquared(edges[3]) == OutType(0.0))
return OutType(0.0);
typename PointCoordVecType::ComponentType cornerNormals[4] = {
Cross(edges[3], edges[0]),
Cross(edges[0], edges[1]),
@ -120,8 +126,9 @@ VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts,
Normalize(unitCenterNormal);
OutType area =
(Dot(unitCenterNormal, cornerNormals[0]) + Dot(unitCenterNormal, cornerNormals[1]) +
Dot(unitCenterNormal, cornerNormals[2]) + Dot(unitCenterNormal, cornerNormals[3])) *
static_cast<OutType>(
(Dot(unitCenterNormal, cornerNormals[0]) + Dot(unitCenterNormal, cornerNormals[1]) +
Dot(unitCenterNormal, cornerNormals[2]) + Dot(unitCenterNormal, cornerNormals[3]))) *
OutType(0.25);
return area;
}
@ -154,7 +161,7 @@ VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts,
typename PointCoordVecType::ComponentType v1 = pts[1] - pts[0];
typename PointCoordVecType::ComponentType v2 = pts[2] - pts[0];
typename PointCoordVecType::ComponentType v3 = pts[3] - pts[0];
OutType volume = Dot(Cross(v1, v2), v3) / OutType(6.0);
OutType volume = static_cast<OutType>(Dot(Cross(v1, v2), v3)) / OutType(6.0);
return volume;
}
@ -198,7 +205,7 @@ VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts,
efg3 -= pts[2];
efg3 -= pts[3];
OutType volume = Dot(Cross(efg2, efg3), efg1) / OutType(64.0);
OutType volume = static_cast<OutType>(Dot(Cross(efg2, efg3), efg1)) / OutType(64.0);
return volume;
}
@ -218,17 +225,17 @@ VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts,
typename PointCoordVecType::ComponentType v0 = pts[1] - pts[0];
typename PointCoordVecType::ComponentType v1 = pts[2] - pts[0];
typename PointCoordVecType::ComponentType v2 = pts[3] - pts[0];
OutType volume = Dot(Cross(v0, v1), v2) / OutType(6.0);
OutType volume = static_cast<OutType>(Dot(Cross(v0, v1), v2)) / OutType(6.0);
typename PointCoordVecType::ComponentType v3 = pts[4] - pts[1];
typename PointCoordVecType::ComponentType v4 = pts[5] - pts[1];
typename PointCoordVecType::ComponentType v5 = pts[3] - pts[1];
volume += Dot(Cross(v3, v4), v5) / OutType(6.0);
volume += static_cast<OutType>(Dot(Cross(v3, v4), v5)) / OutType(6.0);
typename PointCoordVecType::ComponentType v6 = pts[5] - pts[1];
typename PointCoordVecType::ComponentType v7 = pts[2] - pts[1];
typename PointCoordVecType::ComponentType v8 = pts[3] - pts[1];
volume += Dot(Cross(v6, v7), v8) / OutType(6.0);
volume += static_cast<OutType>(Dot(Cross(v6, v7), v8)) / OutType(6.0);
return volume;
}
@ -249,12 +256,12 @@ VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts,
typename PointCoordVecType::ComponentType v1 = pts[1] - pts[0];
typename PointCoordVecType::ComponentType v2 = pts[3] - pts[0];
typename PointCoordVecType::ComponentType v3 = pts[4] - pts[0];
OutType volume = Dot(Cross(v1, v2), v3) / OutType(6.0);
OutType volume = static_cast<OutType>(Dot(Cross(v1, v2), v3)) / OutType(6.0);
typename PointCoordVecType::ComponentType v4 = pts[1] - pts[2];
typename PointCoordVecType::ComponentType v5 = pts[3] - pts[2];
typename PointCoordVecType::ComponentType v6 = pts[4] - pts[2];
volume += Dot(Cross(v5, v4), v6) / OutType(6.0);
volume += static_cast<OutType>(Dot(Cross(v5, v4), v6)) / OutType(6.0);
return volume;
}

@ -65,8 +65,6 @@ inline VTKM_CONT vtkm::cont::DataSet MIRFilter::DoExecute(
const vtkm::cont::DataSet& input,
vtkm::filter::PolicyBase<DerivedPolicy> policy)
{
//{
//(void)input;
//(void)policy;
@ -113,13 +111,14 @@ inline VTKM_CONT vtkm::cont::DataSet MIRFilter::DoExecute(
vtkm::cont::Field or_ids = input.GetField(this->id_name);
vtkm::cont::Field or_vfs = input.GetField(this->vf_name);
// TODO: Check all fields for 'IsFieldCell'
vtkm::cont::ArrayHandle<vtkm::Float32> vfsdata_or, vfsdata;
vtkm::cont::ArrayHandle<vtkm::FloatDefault> vfsdata_or, vfsdata;
vtkm::cont::ArrayHandle<vtkm::Id> idsdata_or, idsdata, lendata_or, lendata, posdata_or, posdata,
allids;
or_pos.GetData().AsArrayHandle(posdata_or);
or_len.GetData().AsArrayHandle(lendata_or);
or_ids.GetData().AsArrayHandle(idsdata_or);
or_vfs.GetData().AsArrayHandle(vfsdata_or);
vtkm::cont::ArrayCopy(idsdata_or, allids);
vtkm::cont::Algorithm::Sort(allids);
vtkm::cont::Algorithm::Unique(allids);
@ -222,7 +221,6 @@ inline VTKM_CONT vtkm::cont::DataSet MIRFilter::DoExecute(
vtkm::worklet::MIR mir;
vtkm::cont::ArrayHandle<vtkm::Id> newCellLookback, newCellID;
vtkm::cont::CellSetExplicit<> out = mir.Run(saved.GetCellSet(),
previousMatVF,
currentMatVF,
@ -265,14 +263,14 @@ inline VTKM_CONT vtkm::cont::DataSet MIRFilter::DoExecute(
// Hacking workaround to not clone an entire dataset.
vtkm::cont::ArrayHandle<vtkm::Float64> avgSize;
vtkm::cont::ArrayHandle<vtkm::FloatDefault> avgSize;
this->Invoke(getVol, saved.GetCellSet(), saved.GetCoordinateSystem(0).GetData(), avgSize);
vtkm::worklet::CalcError_C calcErrC;
vtkm::worklet::Keys<vtkm::Id> cellKeys(cellLookback);
vtkm::cont::ArrayCopy(cellLookback, filterCellInterp);
vtkm::cont::ArrayHandle<vtkm::Id> lenOut, posOut, idsOut;
vtkm::cont::ArrayHandle<vtkm::Float64> vfsOut, totalErrorOut;
vtkm::cont::ArrayHandle<vtkm::FloatDefault> vfsOut, totalErrorOut;
lenOut.Allocate(cellKeys.GetUniqueKeys().GetNumberOfValues());
this->Invoke(calcErrC, cellKeys, prevMat, lendata_or, posdata_or, idsdata_or, lenOut);
@ -299,6 +297,7 @@ inline VTKM_CONT vtkm::cont::DataSet MIRFilter::DoExecute(
vfsOut,
avgSizeTot,
totalErrorOut);
totalError = vtkm::cont::Algorithm::Reduce(totalErrorOut, vtkm::Float64(0));
vtkm::cont::ArrayCopy(lenOut, lendata);
vtkm::cont::ArrayCopy(posOut, posdata);

@ -9,10 +9,16 @@
//============================================================================
#include <vtkm/cont/DataSetBuilderExplicit.h>
#include <vtkm/cont/DataSetBuilderUniform.h>
#include <vtkm/cont/Invoker.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/filter/MIRFilter.h>
#include <vtkm/io/VTKDataSetReader.h>
#include <stdio.h>
void ConnectionHelperHex(std::vector<vtkm::Id>& conn, int x, int y, int z, int mx, int my, int mz)
{
(void)mz;
@ -36,7 +42,7 @@ vtkm::cont::DataSet GetTestDataSet()
std::vector<vtkm::UInt8> shapes;
std::vector<vtkm::Id> connections;
std::vector<vtkm::IdComponent> numberofInd;
std::vector<vtkm::Vec3f_32> points;
std::vector<vtkm::Vec3f> points;
for (int z = 0; z < mz - 1; z++)
{
@ -57,8 +63,8 @@ vtkm::cont::DataSet GetTestDataSet()
vtkm::cont::ArrayHandle<vtkm::Id> lengths =
vtkm::cont::make_ArrayHandle(lnAR, vtkm::CopyFlag::On);
vtkm::cont::ArrayHandle<vtkm::Id> ids = vtkm::cont::make_ArrayHandle(idAR, vtkm::CopyFlag::On);
std::vector<vtkm::Float32> vfAR{ 1, 1, 1, 1, 1, 1, 1, 1 };
vtkm::cont::ArrayHandle<vtkm::Float32> vfs =
std::vector<vtkm::FloatDefault> vfAR{ 1, 1, 1, 1, 1, 1, 1, 1 };
vtkm::cont::ArrayHandle<vtkm::FloatDefault> vfs =
vtkm::cont::make_ArrayHandle(vfAR, vtkm::CopyFlag::On);
shapes.reserve((mx - 1) * (my - 1) * (mz - 1));
@ -92,7 +98,134 @@ vtkm::cont::DataSet GetTestDataSet()
return ds;
}
void TestMIR()
class MetaDataLength : public vtkm::worklet::WorkletMapField
{
public:
using ControlSignature = void(FieldIn, FieldIn, FieldIn, FieldIn, FieldOut);
VTKM_EXEC
void operator()(const vtkm::FloatDefault& background,
const vtkm::FloatDefault& circle_a,
const vtkm::FloatDefault& circle_b,
const vtkm::FloatDefault& circle_c,
vtkm::Id& length) const
{
length = 0;
if (background > vtkm::FloatDefault(0.0))
length++;
if (circle_a > vtkm::FloatDefault(0.0))
length++;
if (circle_b > vtkm::FloatDefault(0.0))
length++;
if (circle_c > vtkm::FloatDefault(0.0))
length++;
}
};
class MetaDataPopulate : public vtkm::worklet::WorkletMapField
{
public:
using ControlSignature =
void(FieldIn, FieldIn, FieldIn, FieldIn, FieldIn, WholeArrayOut, WholeArrayOut);
template <typename IdArray, typename DataArray>
VTKM_EXEC void operator()(const vtkm::Id& offset,
const vtkm::FloatDefault& background,
const vtkm::FloatDefault& circle_a,
const vtkm::FloatDefault& circle_b,
const vtkm::FloatDefault& circle_c,
IdArray& matIds,
DataArray& matVFs) const
{
vtkm::Id index = offset;
if (background > vtkm::FloatDefault(0.0))
{
matIds.Set(index, 1);
matVFs.Set(index, background);
index++;
}
if (circle_a > vtkm::FloatDefault(0.0))
{
matIds.Set(index, 2);
matVFs.Set(index, circle_a);
index++;
}
if (circle_b > vtkm::FloatDefault(0.0))
{
matIds.Set(index, 3);
matVFs.Set(index, circle_b);
index++;
}
if (circle_c > vtkm::FloatDefault(0.0))
{
matIds.Set(index, 4);
matVFs.Set(index, circle_c);
index++;
}
}
};
void TestMIRVenn250()
{
using IdArray = vtkm::cont::ArrayHandle<vtkm::Id>;
using DataArray = vtkm::cont::ArrayHandle<vtkm::FloatDefault>;
vtkm::cont::Invoker invoker;
std::string vennFile = vtkm::cont::testing::Testing::DataPath("uniform/venn250.vtk");
vtkm::io::VTKDataSetReader reader(vennFile);
vtkm::cont::DataSet data = reader.ReadDataSet();
DataArray backArr;
data.GetField("mesh_topo/background").GetDataAsDefaultFloat().AsArrayHandle(backArr);
DataArray cirAArr;
data.GetField("mesh_topo/circle_a").GetDataAsDefaultFloat().AsArrayHandle(cirAArr);
DataArray cirBArr;
data.GetField("mesh_topo/circle_b").GetDataAsDefaultFloat().AsArrayHandle(cirBArr);
DataArray cirCArr;
data.GetField("mesh_topo/circle_c").GetDataAsDefaultFloat().AsArrayHandle(cirCArr);
IdArray length;
IdArray offset;
IdArray matIds;
DataArray matVFs;
invoker(MetaDataLength{}, backArr, cirAArr, cirBArr, cirCArr, length);
vtkm::cont::Algorithm::ScanExclusive(length, offset);
vtkm::Id total = vtkm::cont::Algorithm::Reduce(length, vtkm::Id(0));
matIds.Allocate(total);
matVFs.Allocate(total);
invoker(MetaDataPopulate{}, offset, backArr, cirAArr, cirBArr, cirCArr, matIds, matVFs);
data.AddField(vtkm::cont::Field("scatter_pos", vtkm::cont::Field::Association::CELL_SET, offset));
data.AddField(vtkm::cont::Field("scatter_len", vtkm::cont::Field::Association::CELL_SET, length));
data.AddField(
vtkm::cont::Field("scatter_ids", vtkm::cont::Field::Association::WHOLE_MESH, matIds));
data.AddField(
vtkm::cont::Field("scatter_vfs", vtkm::cont::Field::Association::WHOLE_MESH, matVFs));
vtkm::filter::MIRFilter mir;
mir.SetIDWholeSetName("scatter_ids");
mir.SetPositionCellSetName("scatter_pos");
mir.SetLengthCellSetName("scatter_len");
mir.SetVFWholeSetName("scatter_vfs");
mir.SetErrorScaling(vtkm::Float64(0.2));
mir.SetScalingDecay(vtkm::Float64(1.0));
mir.SetMaxIterations(vtkm::IdComponent(0)); // =0 -> No iterations..
// Only useful for iterations >= 1, will stop iterating if total % error for entire mesh is less than this value
// Note it is mathematically impossible to obtain 0% error outside of VERY special cases (neglecting float error)
mir.SetMaxPercentError(vtkm::Float64(0.00001));
VTKM_LOG_S(vtkm::cont::LogLevel::Warn, "Before executing filter w/ Venn data");
vtkm::cont::DataSet fromMIR = mir.Execute(data);
VTKM_LOG_S(vtkm::cont::LogLevel::Warn, "After executing filter w/ Venn data");
VTKM_TEST_ASSERT(fromMIR.GetNumberOfCells() == 66086, "Wrong number of output cells");
}
void TestMIRSynthetic()
{
vtkm::cont::DataSet ds = GetTestDataSet();
@ -118,6 +251,12 @@ void TestMIR()
VTKM_TEST_ASSERT(ds_from_mir.GetNumberOfCells() == 40, "Wrong number of output cells");
}
void TestMIR()
{
TestMIRSynthetic();
TestMIRVenn250();
}
int UnitTestMIRFilter(int argc, char* argv[])
{
return vtkm::cont::testing::Testing::Run(TestMIR, argc, argv);

@ -1765,9 +1765,6 @@ private:
}
}
namespace vtkm
{
namespace worklet
@ -1781,51 +1778,36 @@ public:
public:
VTKM_EXEC FloatType GetVFForPoint(IDType point, IDType matID, IDType) const
{
IDType vfPos = BinarySearchForKey(
matID, this->PPos.Get(point), this->PPos.Get(point) + this->PLens.Get(point) - 1);
if (vfPos == IDType(-1))
IDType low = this->PPos.Get(point);
IDType high = this->PPos.Get(point) + this->PLens.Get(point) - 1;
IDType matIdAt = -1;
while (low <= high)
{
for (vtkm::IdComponent s = vtkm::IdComponent(this->PPos.Get(point));
s < vtkm::IdComponent(this->PPos.Get(point) + this->PLens.Get(point));
s++)
IDType mid = (low + high) / 2;
IDType midMatId = this->PIDs.Get(mid);
if (matID == midMatId)
{
if (this->PIDs.Get(s) == matID)
{
return FloatType(0);
}
matIdAt = mid;
break;
}
return FloatType(0);
else if (matID > midMatId)
{
low = mid + 1;
}
else if (matID < midMatId)
{
high = mid - 1;
}
}
if (matIdAt >= 0)
{
return this->PVFs.Get(matIdAt);
}
else
{
return this->PVFs.Get(vfPos);
}
return FloatType(0);
}
private:
VTKM_EXEC IDType BinarySearchForKey(IDType matID, IDType low, IDType high) const
{
if (high < low)
{
return IDType(-1);
}
IDType mid = (low + high) / 2;
IDType midpoint = this->PIDs.Get(mid);
if (matID == midpoint)
{
return mid;
}
if (matID > midpoint)
{
return BinarySearchForKey(matID, (mid + 1), high);
}
else
{
return BinarySearchForKey(matID, low, mid - 1);
}
}
typename vtkm::cont::ArrayHandle<IDType, vtkm::cont::StorageTagBasic>::ReadPortalType PLens;
typename vtkm::cont::ArrayHandle<IDType, vtkm::cont::StorageTagBasic>::ReadPortalType PPos;
typename vtkm::cont::ArrayHandle<IDType, vtkm::cont::StorageTagBasic>::ReadPortalType PIDs;
@ -1838,13 +1820,14 @@ public:
VTKM_CONT vtkm::cont::ArrayHandle<IDType> getPointIDArr() { return this->pointIDs; }
VTKM_CONT vtkm::cont::ArrayHandle<FloatType> getPointVFArr() { return this->pointVFs; }
// Do we need to copy these arrays?
template <typename IDInput, typename FloatInput>
MIRObject(const IDInput len, const IDInput pos, const IDInput ids, const FloatInput floats)
MIRObject(const IDInput& len, const IDInput& pos, const IDInput& ids, const FloatInput& floats)
: pointLen(len)
, pointPos(pos)
, pointIDs(ids)
, pointVFs(floats)
{
vtkm::cont::ArrayCopy(len, pointLen);
vtkm::cont::ArrayCopy(pos, pointPos);
vtkm::cont::ArrayCopy(ids, pointIDs);
vtkm::cont::ArrayCopy(floats, pointVFs);
}
MIRObjectPortal PrepareForExecution(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token)
@ -1924,6 +1907,7 @@ public:
outlength = uniqueMats;
}
};
struct CombineVFsForPoints : public vtkm::worklet::WorkletVisitPointsWithCells
{
public:
@ -2011,6 +1995,7 @@ public:
}
}
};
struct ExtractVFsForMIR_C : public vtkm::worklet::WorkletVisitCellsWithPoints
{
public:
@ -2023,6 +2008,7 @@ public:
outlength = numPoints;
}
};
struct ExtractVFsForMIR : public vtkm::worklet::WorkletVisitCellsWithPoints
{
public:
@ -2071,6 +2057,7 @@ public:
private:
vtkm::Id target;
};
struct CalcVol : public vtkm::worklet::WorkletVisitCellsWithPoints
{
public:
@ -2090,7 +2077,7 @@ public:
vtkm::Float64 totVol = vtkm::Float64(0);
vtkm::IdComponent offset = mirTable.GetFaceOffset(static_cast<vtkm::Id>(cellShape.Id));
//VTKM_LOG_S(vtkm::cont::LogLevel::Info, "CELL! " << offset << " " << numFaces);
auto av1 = vertPos[0];
for (vtkm::IdComponent i = 1; i < pointCount; i++)
{
@ -2103,7 +2090,6 @@ public:
vtkm::UInt8 p1 = mirTable.GetPoint(offset++);
vtkm::UInt8 p2 = mirTable.GetPoint(offset++);
vtkm::UInt8 p3 = mirTable.GetPoint(offset++);
//VTKM_LOG_S(vtkm::cont::LogLevel::Info, (i+1) << "/" << numFaces << " " << static_cast<vtkm::Id>(p1)<<" " << static_cast<vtkm::Id>(p2)<<" " << static_cast<vtkm::Id>(p3) << " " << offset);
auto v1 = vertPos[p1];
auto v2 = vertPos[p2];
auto v3 = vertPos[p3];
@ -2116,6 +2102,7 @@ public:
volumeOut = totVol;
}
};
struct CalcError_C : public vtkm::worklet::WorkletReduceByKey
{
public:
@ -2136,7 +2123,8 @@ public:
const ORID& orgID,
NLO& outputLen) const
{
// Although I don't doubt for a minute that keys is sorted and hence the output would be too, but this ensures I don't deal with a headache if they change that.
// Although I don't doubt for a minute that keys is sorted and hence the output would be too,
// but this ensures I don't deal with a headache if they change that.
// The orgLen and orgPos are the true, original cell IDs and VFs
// Luckily indexing into cellID should be quick compared to orgLen...
vtkm::Id lowest = orgID.Get(orgPos.Get(0));
@ -2181,6 +2169,7 @@ public:
outputLen.Set(cellID, uniqueMats);
}
};
struct CalcError : public vtkm::worklet::WorkletReduceByKey
{
private:
@ -2246,7 +2235,8 @@ public:
const OVols& orgVols,
TEO& totalErrorOut) const
{
// Although I don't doubt for a minute that keys is sorted and hence the output would be too, but this ensures I don't deal with a headache if they change that.
// Although I don't doubt for a minute that keys is sorted and hence the output would be too,
// but this ensures I don't deal with a headache if they change that.
// The orgLen and orgPos are the true, original cell IDs and VFs
// Luckily indexing into cellID should be quick compared to orgLen...
//{
@ -2320,13 +2310,13 @@ public:
// << totalVolForColor << " L: " << this->lerping << " and " << prevTarget << " / " << totalError
// << "\n" << inputPos.Get(cellID));
inputIDs.Set(inputPos.Get(cellID) + uniqueMats, lowest);
inputVFs.Set(inputPos.Get(cellID) + uniqueMats, prevTarget);
inputVFs.Set(inputPos.Get(cellID) + uniqueMats, vtkm::FloatDefault(prevTarget));
uniqueMats++;
prevLowest = lowest;
lowest = largest;
}
totalErrorOut = totalError;
totalErrorOut = TEO(totalError);
}
};
struct CheckFor2D : public vtkm::worklet::WorkletVisitCellsWithPoints
@ -2374,6 +2364,7 @@ struct CheckFor2D : public vtkm::worklet::WorkletVisitCellsWithPoints
}
}
};
struct ConstructCellWeightList : public vtkm::worklet::WorkletMapField
{
using ControlSignature = void(FieldIn pointIDs, FieldOut VecLookback, FieldOut VecWeights);
@ -2391,6 +2382,7 @@ struct ConstructCellWeightList : public vtkm::worklet::WorkletMapField
weights[0] = vtkm::Float64(1);
}
};
struct DestructPointWeightList : public vtkm::worklet::WorkletMapField
{
using ControlSignature = void(FieldIn pointIDs,
@ -2417,6 +2409,7 @@ struct DestructPointWeightList : public vtkm::worklet::WorkletMapField
}
}
};
}
}

@ -110,8 +110,8 @@ VTKM_EXEC OutType CellAspectRatioMetric(const vtkm::IdComponent& numPts,
const Vector X1 = GetQuadX0<Scalar, Vector, CollectionOfPoints>(pts);
const Vector X2 = GetQuadX1<Scalar, Vector, CollectionOfPoints>(pts);
const Scalar x1 = vtkm::Sqrt(vtkm::MagnitudeSquared(X1));
const Scalar x2 = vtkm::Sqrt(vtkm::MagnitudeSquared(X2));
const Scalar x1 = static_cast<Scalar>(vtkm::Sqrt(vtkm::MagnitudeSquared(X1)));
const Scalar x2 = static_cast<Scalar>(vtkm::Sqrt(vtkm::MagnitudeSquared(X2)));
if (x1 <= Scalar(0.0) || x2 <= Scalar(0.0))
{
return vtkm::Infinity<Scalar>();
@ -142,9 +142,9 @@ VTKM_EXEC OutType CellAspectRatioMetric(const vtkm::IdComponent& numPts,
const Vector X2 = GetHexX2<Scalar, Vector, CollectionOfPoints>(pts);
const Vector X3 = GetHexX3<Scalar, Vector, CollectionOfPoints>(pts);
const Scalar x1 = vtkm::Sqrt(vtkm::MagnitudeSquared(X1));
const Scalar x2 = vtkm::Sqrt(vtkm::MagnitudeSquared(X2));
const Scalar x3 = vtkm::Sqrt(vtkm::MagnitudeSquared(X3));
const Scalar x1 = static_cast<Scalar>(vtkm::Sqrt(vtkm::MagnitudeSquared(X1)));
const Scalar x2 = static_cast<Scalar>(vtkm::Sqrt(vtkm::MagnitudeSquared(X2)));
const Scalar x3 = static_cast<Scalar>(vtkm::Sqrt(vtkm::MagnitudeSquared(X3)));
if (x1 <= Scalar(0.0) || x2 <= Scalar(0.0) || x3 <= Scalar(0.0))
{

@ -93,7 +93,8 @@ VTKM_EXEC OutType CellConditionMetric(const vtkm::IdComponent& numPts,
const Vector L2 = GetTriangleL2<Scalar, Vector, CollectionOfPoints>(pts);
const Scalar q =
(vtkm::Dot(L2, L2) + vtkm::Dot(L1, L1) + vtkm::Dot(L1, L2)) / (two * area * rootThree);
static_cast<Scalar>((vtkm::Dot(L2, L2) + vtkm::Dot(L1, L1) + vtkm::Dot(L1, L2))) /
(two * area * rootThree);
return q;
}
@ -164,7 +165,7 @@ VTKM_EXEC OutType CellConditionMetric(const vtkm::IdComponent& numPts,
const Vector C2 = ((negTwo * L2) - L0) / root3;
const Vector C3 = ((three * L3) + L2 - L0) / root6;
const Scalar cDet = vtkm::Dot(C1, vtkm::Cross(C2, C3));
const Scalar cDet = static_cast<Scalar>(vtkm::Dot(C1, vtkm::Cross(C2, C3)));
if (cDet <= Scalar(0.0))
{
@ -175,8 +176,9 @@ VTKM_EXEC OutType CellConditionMetric(const vtkm::IdComponent& numPts,
const Vector C2xC3 = vtkm::Cross(C2, C3);
const Vector C1xC3 = vtkm::Cross(C1, C3);
const Scalar t1 = vtkm::Dot(C1, C1) + vtkm::Dot(C2, C2) + vtkm::Dot(C3, C3);
const Scalar t2 = vtkm::Dot(C1xC2, C1xC2) + vtkm::Dot(C2xC3, C2xC3) + vtkm::Dot(C1xC3, C1xC3);
const Scalar t1 = static_cast<Scalar>(vtkm::Dot(C1, C1) + vtkm::Dot(C2, C2) + vtkm::Dot(C3, C3));
const Scalar t2 = static_cast<Scalar>(vtkm::Dot(C1xC2, C1xC2) + vtkm::Dot(C2xC3, C2xC3) +
vtkm::Dot(C1xC3, C1xC3));
const Scalar q = vtkm::Sqrt(t1 * t2) / (three * cDet);
return q;

@ -80,32 +80,32 @@ VTKM_EXEC OutType CellDimensionMetric(const vtkm::IdComponent& numPts,
UNUSED(ec);
OutType gradop[8][3];
OutType x1 = pts[0][0];
OutType x2 = pts[1][0];
OutType x3 = pts[2][0];
OutType x4 = pts[3][0];
OutType x5 = pts[4][0];
OutType x6 = pts[5][0];
OutType x7 = pts[6][0];
OutType x8 = pts[7][0];
OutType x1 = static_cast<OutType>(pts[0][0]);
OutType x2 = static_cast<OutType>(pts[1][0]);
OutType x3 = static_cast<OutType>(pts[2][0]);
OutType x4 = static_cast<OutType>(pts[3][0]);
OutType x5 = static_cast<OutType>(pts[4][0]);
OutType x6 = static_cast<OutType>(pts[5][0]);
OutType x7 = static_cast<OutType>(pts[6][0]);
OutType x8 = static_cast<OutType>(pts[7][0]);
OutType y1 = pts[0][1];
OutType y2 = pts[1][1];
OutType y3 = pts[2][1];
OutType y4 = pts[3][1];
OutType y5 = pts[4][1];
OutType y6 = pts[5][1];
OutType y7 = pts[6][1];
OutType y8 = pts[7][1];
OutType y1 = static_cast<OutType>(pts[0][1]);
OutType y2 = static_cast<OutType>(pts[1][1]);
OutType y3 = static_cast<OutType>(pts[2][1]);
OutType y4 = static_cast<OutType>(pts[3][1]);
OutType y5 = static_cast<OutType>(pts[4][1]);
OutType y6 = static_cast<OutType>(pts[5][1]);
OutType y7 = static_cast<OutType>(pts[6][1]);
OutType y8 = static_cast<OutType>(pts[7][1]);
OutType z1 = pts[0][2];
OutType z2 = pts[1][2];
OutType z3 = pts[2][2];
OutType z4 = pts[3][2];
OutType z5 = pts[4][2];
OutType z6 = pts[5][2];
OutType z7 = pts[6][2];
OutType z8 = pts[7][2];
OutType z1 = static_cast<OutType>(pts[0][2]);
OutType z2 = static_cast<OutType>(pts[1][2]);
OutType z3 = static_cast<OutType>(pts[2][2]);
OutType z4 = static_cast<OutType>(pts[3][2]);
OutType z5 = static_cast<OutType>(pts[4][2]);
OutType z6 = static_cast<OutType>(pts[5][2]);
OutType z7 = static_cast<OutType>(pts[6][2]);
OutType z8 = static_cast<OutType>(pts[7][2]);
OutType z24 = z2 - z4;
OutType z52 = z5 - z2;
@ -274,9 +274,10 @@ VTKM_EXEC OutType CellDimensionMetric(const vtkm::IdComponent& numPts,
gradop[7][2] = (x7 * (y3 - y6 - y54) + x6 * y75 + x5 * (y6 - y1 - y47) + x4 * (y1 - y3 - y75) +
x3 * y47 + x1 * y54) /
(OutType)12.0;
OutType volume = pts[0][0] * gradop[0][0] + pts[1][0] * gradop[1][0] + pts[2][0] * gradop[2][0] +
pts[3][0] * gradop[3][0] + pts[4][0] * gradop[4][0] + pts[5][0] * gradop[5][0] +
pts[6][0] * gradop[6][0] + pts[7][0] * gradop[7][0];
OutType volume = OutType(pts[0][0]) * gradop[0][0] + OutType(pts[1][0]) * gradop[1][0] +
OutType(pts[2][0]) * gradop[2][0] + OutType(pts[3][0]) * gradop[3][0] +
OutType(pts[4][0]) * gradop[4][0] + OutType(pts[5][0]) * gradop[5][0] +
OutType(pts[6][0]) * gradop[6][0] + OutType(pts[7][0]) * gradop[7][0];
OutType two = (OutType)2.;
OutType aspect = (OutType).5 * vtkm::Pow(volume, two) /
(vtkm::Pow(gradop[0][0], two) + vtkm::Pow(gradop[1][0], two) + vtkm::Pow(gradop[2][0], two) +

@ -176,7 +176,7 @@ VTKM_EXEC OutType CellJacobianMetric(const vtkm::IdComponent& numPts,
const Vector L2 = GetTetraL2<Scalar, Vector, CollectionOfPoints>(pts);
const Vector L3 = GetTetraL3<Scalar, Vector, CollectionOfPoints>(pts);
const Scalar q = vtkm::Dot(vtkm::Cross(L2, L0), L3);
const Scalar q = static_cast<Scalar>((vtkm::Dot(vtkm::Cross(L2, L0), L3)));
return q;
}

@ -164,16 +164,20 @@ VTKM_EXEC OutType CellMaxAngleMetric(const vtkm::IdComponent& numPts,
const Scalar oneEightyOverPi = (Scalar)57.2957795131; // ~ 180/pi
const Scalar threeSixty(360.0);
const Scalar q0 =
(vtkm::Pow(neg1, s0) * vtkm::ACos(neg1 * ((vtkm::Dot(L0, L1)) / (l0 * l1))) * oneEightyOverPi) +
(vtkm::Pow(neg1, s0) * vtkm::ACos(neg1 * (static_cast<Scalar>(vtkm::Dot(L0, L1)) / (l0 * l1))) *
oneEightyOverPi) +
(threeSixty * s0);
const Scalar q1 =
(vtkm::Pow(neg1, s1) * vtkm::ACos(neg1 * ((vtkm::Dot(L1, L2)) / (l1 * l2))) * oneEightyOverPi) +
(vtkm::Pow(neg1, s1) * vtkm::ACos(neg1 * (static_cast<Scalar>(vtkm::Dot(L1, L2)) / (l1 * l2))) *
oneEightyOverPi) +
(threeSixty * s1);
const Scalar q2 =
(vtkm::Pow(neg1, s2) * vtkm::ACos(neg1 * ((vtkm::Dot(L2, L3)) / (l2 * l3))) * oneEightyOverPi) +
(vtkm::Pow(neg1, s2) * vtkm::ACos(neg1 * (static_cast<Scalar>(vtkm::Dot(L2, L3)) / (l2 * l3))) *
oneEightyOverPi) +
(threeSixty * s2);
const Scalar q3 =
(vtkm::Pow(neg1, s3) * vtkm::ACos(neg1 * ((vtkm::Dot(L3, L0)) / (l3 * l0))) * oneEightyOverPi) +
(vtkm::Pow(neg1, s3) * vtkm::ACos(neg1 * (static_cast<Scalar>(vtkm::Dot(L3, L0)) / (l3 * l0))) *
oneEightyOverPi) +
(threeSixty * s3);
const Scalar q = vtkm::Max(q0, vtkm::Max(q1, vtkm::Max(q2, q3)));

@ -71,15 +71,16 @@ VTKM_EXEC OutType ComputeTetCondition(const VecType edges[])
if (det <= vtkm::NegativeInfinity<OutType>())
return vtkm::Infinity<OutType>();
OutType term1 =
vtkm::Dot(edges[0], edges[0]) + vtkm::Dot(edges[1], edges[1]) + vtkm::Dot(edges[2], edges[2]);
OutType term1 = static_cast<OutType>(
vtkm::Dot(edges[0], edges[0]) + vtkm::Dot(edges[1], edges[1]) + vtkm::Dot(edges[2], edges[2]));
VecType crosses[3] = { vtkm::Cross(edges[0], edges[1]),
vtkm::Cross(edges[1], edges[2]),
vtkm::Cross(edges[2], edges[0]) };
OutType term2 = vtkm::Dot(crosses[0], crosses[0]) + vtkm::Dot(crosses[1], crosses[1]) +
vtkm::Dot(crosses[2], crosses[2]);
OutType term2 =
static_cast<OutType>(vtkm::Dot(crosses[0], crosses[0]) + vtkm::Dot(crosses[1], crosses[1]) +
vtkm::Dot(crosses[2], crosses[2]));
return vtkm::Sqrt(term1 * term2) / det;
}

@ -82,28 +82,28 @@ VTKM_EXEC OutType CellMaxDiagonalMetric(const vtkm::IdComponent& numPts,
//lengths^2 f diag nals
for (i = 0; i < 3; i++)
{
temp[i] = pts[6][i] - pts[0][i];
temp[i] = static_cast<Scalar>(pts[6][i] - pts[0][i]);
temp[i] = temp[i] * temp[i];
}
diag[0] = vtkm::Sqrt(temp[0] + temp[1] + temp[2]);
for (i = 0; i < 3; i++)
{
temp[i] = pts[4][i] - pts[2][i];
temp[i] = static_cast<Scalar>(pts[4][i] - pts[2][i]);
temp[i] = temp[i] * temp[i];
}
diag[1] = vtkm::Sqrt(temp[0] + temp[1] + temp[2]);
for (i = 0; i < 3; i++)
{
temp[i] = pts[7][i] - pts[1][i];
temp[i] = static_cast<Scalar>(pts[7][i] - pts[1][i]);
temp[i] = temp[i] * temp[i];
}
diag[2] = vtkm::Sqrt(temp[0] + temp[1] + temp[2]);
for (i = 0; i < 3; i++)
{
temp[i] = pts[5][i] - pts[3][i];
temp[i] = static_cast<Scalar>(pts[5][i] - pts[3][i]);
temp[i] = temp[i] * temp[i];
}
diag[3] = vtkm::Sqrt(temp[0] + temp[1] + temp[2]);

@ -161,16 +161,20 @@ VTKM_EXEC OutType CellMinAngleMetric(const vtkm::IdComponent& numPts,
const Scalar oneEightyOverPi = (Scalar)57.2957795131; // ~ 180/pi
const Scalar threeSixty(360.0);
const Scalar q0 =
(vtkm::Pow(neg1, s0) * vtkm::ACos(neg1 * ((vtkm::Dot(L0, L1)) / (l0 * l1))) * oneEightyOverPi) +
(vtkm::Pow(neg1, s0) * vtkm::ACos(neg1 * (static_cast<Scalar>(vtkm::Dot(L0, L1)) / (l0 * l1))) *
oneEightyOverPi) +
(threeSixty * s0);
const Scalar q1 =
(vtkm::Pow(neg1, s1) * vtkm::ACos(neg1 * ((vtkm::Dot(L1, L2)) / (l1 * l2))) * oneEightyOverPi) +
(vtkm::Pow(neg1, s1) * vtkm::ACos(neg1 * (static_cast<Scalar>(vtkm::Dot(L1, L2)) / (l1 * l2))) *
oneEightyOverPi) +
(threeSixty * s1);
const Scalar q2 =
(vtkm::Pow(neg1, s2) * vtkm::ACos(neg1 * ((vtkm::Dot(L2, L3)) / (l2 * l3))) * oneEightyOverPi) +
(vtkm::Pow(neg1, s2) * vtkm::ACos(neg1 * (static_cast<Scalar>(vtkm::Dot(L2, L3)) / (l2 * l3))) *
oneEightyOverPi) +
(threeSixty * s2);
const Scalar q3 =
(vtkm::Pow(neg1, s3) * vtkm::ACos(neg1 * ((vtkm::Dot(L3, L0)) / (l3 * l0))) * oneEightyOverPi) +
(vtkm::Pow(neg1, s3) * vtkm::ACos(neg1 * (static_cast<Scalar>(vtkm::Dot(L3, L0)) / (l3 * l0))) *
oneEightyOverPi) +
(threeSixty * s3);
const Scalar q = vtkm::Min(q0, vtkm::Min(q1, vtkm::Min(q2, q3)));

@ -82,28 +82,28 @@ VTKM_EXEC OutType CellMinDiagonalMetric(const vtkm::IdComponent& numPts,
//lengths^2 f diag nals
for (i = 0; i < 3; i++)
{
temp[i] = pts[6][i] - pts[0][i];
temp[i] = static_cast<Scalar>(pts[6][i] - pts[0][i]);
temp[i] = temp[i] * temp[i];
}
diag[0] = vtkm::Sqrt(temp[0] + temp[1] + temp[2]);
for (i = 0; i < 3; i++)
{
temp[i] = pts[4][i] - pts[2][i];
temp[i] = static_cast<Scalar>(pts[4][i] - pts[2][i]);
temp[i] = temp[i] * temp[i];
}
diag[1] = vtkm::Sqrt(temp[0] + temp[1] + temp[2]);
for (i = 0; i < 3; i++)
{
temp[i] = pts[7][i] - pts[1][i];
temp[i] = static_cast<Scalar>(pts[7][i] - pts[1][i]);
temp[i] = temp[i] * temp[i];
}
diag[2] = vtkm::Sqrt(temp[0] + temp[1] + temp[2]);
for (i = 0; i < 3; i++)
{
temp[i] = pts[5][i] - pts[3][i];
temp[i] = static_cast<Scalar>(pts[5][i] - pts[3][i]);
temp[i] = temp[i] * temp[i];
}
diag[3] = vtkm::Sqrt(temp[0] + temp[1] + temp[2]);

@ -78,12 +78,12 @@ VTKM_EXEC Scalar GetQuadOddyQi(const Vector& Li, const Vector& LiPlus1, const Ve
{
const Scalar two(2.0);
const Scalar four(4.0);
const Scalar liMagnitudeSquared = vtkm::MagnitudeSquared(Li);
const Scalar liPlus1MagnitudeSquared = vtkm::MagnitudeSquared(LiPlus1);
const Scalar niPlus1MagnitudeSquared = vtkm::MagnitudeSquared(NiPlus1);
const Scalar liMagnitudeSquared = static_cast<Scalar>(vtkm::MagnitudeSquared(Li));
const Scalar liPlus1MagnitudeSquared = static_cast<Scalar>(vtkm::MagnitudeSquared(LiPlus1));
const Scalar niPlus1MagnitudeSquared = static_cast<Scalar>(vtkm::MagnitudeSquared(NiPlus1));
const Scalar q = (((liMagnitudeSquared - liPlus1MagnitudeSquared) *
(liMagnitudeSquared - liPlus1MagnitudeSquared)) +
(four * (vtkm::Dot(Li, LiPlus1) * vtkm::Dot(Li, LiPlus1)))) /
(four * static_cast<Scalar>(vtkm::Dot(Li, LiPlus1) * vtkm::Dot(Li, LiPlus1)))) /
(two * niPlus1MagnitudeSquared);
return q;
@ -190,21 +190,21 @@ VTKM_EXEC OutType CellOddyMetric(const vtkm::IdComponent& numPts,
// Note that the values 1_2 = 2_1, 1_3 = 3_1, and 2_3 = 3_2.
// This fact is used to optimize the computation
*/
tempMatrix1_1 =
vtkm::Dot(hexJacobianMatrices[matrixNumber][0], hexJacobianMatrices[matrixNumber][0]);
tempMatrix1_2 =
vtkm::Dot(hexJacobianMatrices[matrixNumber][0], hexJacobianMatrices[matrixNumber][1]);
tempMatrix1_3 =
vtkm::Dot(hexJacobianMatrices[matrixNumber][0], hexJacobianMatrices[matrixNumber][2]);
tempMatrix2_2 =
vtkm::Dot(hexJacobianMatrices[matrixNumber][1], hexJacobianMatrices[matrixNumber][1]);
tempMatrix2_3 =
vtkm::Dot(hexJacobianMatrices[matrixNumber][1], hexJacobianMatrices[matrixNumber][2]);
tempMatrix3_3 =
vtkm::Dot(hexJacobianMatrices[matrixNumber][2], hexJacobianMatrices[matrixNumber][2]);
determinant = vtkm::Dot(
tempMatrix1_1 = static_cast<OutType>(
vtkm::Dot(hexJacobianMatrices[matrixNumber][0], hexJacobianMatrices[matrixNumber][0]));
tempMatrix1_2 = static_cast<OutType>(
vtkm::Dot(hexJacobianMatrices[matrixNumber][0], hexJacobianMatrices[matrixNumber][1]));
tempMatrix1_3 = static_cast<OutType>(
vtkm::Dot(hexJacobianMatrices[matrixNumber][0], hexJacobianMatrices[matrixNumber][2]));
tempMatrix2_2 = static_cast<OutType>(
vtkm::Dot(hexJacobianMatrices[matrixNumber][1], hexJacobianMatrices[matrixNumber][1]));
tempMatrix2_3 = static_cast<OutType>(
vtkm::Dot(hexJacobianMatrices[matrixNumber][1], hexJacobianMatrices[matrixNumber][2]));
tempMatrix3_3 = static_cast<OutType>(
vtkm::Dot(hexJacobianMatrices[matrixNumber][2], hexJacobianMatrices[matrixNumber][2]));
determinant = static_cast<OutType>(vtkm::Dot(
hexJacobianMatrices[matrixNumber][0],
vtkm::Cross(hexJacobianMatrices[matrixNumber][1], hexJacobianMatrices[matrixNumber][2]));
vtkm::Cross(hexJacobianMatrices[matrixNumber][1], hexJacobianMatrices[matrixNumber][2])));
if (determinant <= OutType(0.0))
{
return vtkm::Infinity<OutType>();

@ -151,26 +151,26 @@ VTKM_EXEC OutType CellRelativeSizeSquaredMetric(const vtkm::IdComponent& numPts,
ec = vtkm::ErrorCode::InvalidNumberOfPoints;
return OutType(-1.);
}
OutType X1x = (pts[1][0] - pts[0][0]) + (pts[2][0] - pts[3][0]) + (pts[5][0] - pts[4][0]) +
(pts[6][0] - pts[7][0]);
OutType X1y = (pts[1][1] - pts[0][1]) + (pts[2][1] - pts[3][1]) + (pts[5][1] - pts[4][1]) +
(pts[6][1] - pts[7][1]);
OutType X1z = (pts[1][2] - pts[0][2]) + (pts[2][2] - pts[3][2]) + (pts[5][2] - pts[4][2]) +
(pts[6][2] - pts[7][2]);
OutType X1x = static_cast<OutType>((pts[1][0] - pts[0][0]) + (pts[2][0] - pts[3][0]) +
(pts[5][0] - pts[4][0]) + (pts[6][0] - pts[7][0]));
OutType X1y = static_cast<OutType>((pts[1][1] - pts[0][1]) + (pts[2][1] - pts[3][1]) +
(pts[5][1] - pts[4][1]) + (pts[6][1] - pts[7][1]));
OutType X1z = static_cast<OutType>((pts[1][2] - pts[0][2]) + (pts[2][2] - pts[3][2]) +
(pts[5][2] - pts[4][2]) + (pts[6][2] - pts[7][2]));
OutType X2x = (pts[2][0] - pts[0][0]) + (pts[2][0] - pts[1][0]) + (pts[7][0] - pts[4][0]) +
(pts[6][0] - pts[5][0]);
OutType X2y = (pts[2][1] - pts[0][1]) + (pts[2][1] - pts[1][1]) + (pts[7][1] - pts[4][1]) +
(pts[6][1] - pts[5][1]);
OutType X2z = (pts[2][2] - pts[0][2]) + (pts[2][2] - pts[1][2]) + (pts[7][2] - pts[4][2]) +
(pts[6][2] - pts[5][2]);
OutType X2x = static_cast<OutType>((pts[2][0] - pts[0][0]) + (pts[2][0] - pts[1][0]) +
(pts[7][0] - pts[4][0]) + (pts[6][0] - pts[5][0]));
OutType X2y = static_cast<OutType>((pts[2][1] - pts[0][1]) + (pts[2][1] - pts[1][1]) +
(pts[7][1] - pts[4][1]) + (pts[6][1] - pts[5][1]));
OutType X2z = static_cast<OutType>((pts[2][2] - pts[0][2]) + (pts[2][2] - pts[1][2]) +
(pts[7][2] - pts[4][2]) + (pts[6][2] - pts[5][2]));
OutType X3x = (pts[4][0] - pts[0][0]) + (pts[5][0] - pts[1][0]) + (pts[6][0] - pts[2][0]) +
(pts[7][0] - pts[3][0]);
OutType X3y = (pts[4][1] - pts[0][1]) + (pts[5][1] - pts[1][1]) + (pts[6][1] - pts[2][1]) +
(pts[7][1] - pts[3][1]);
OutType X3z = (pts[4][2] - pts[0][2]) + (pts[5][2] - pts[1][2]) + (pts[6][2] - pts[2][2]) +
(pts[7][2] - pts[3][2]);
OutType X3x = static_cast<OutType>((pts[4][0] - pts[0][0]) + (pts[5][0] - pts[1][0]) +
(pts[6][0] - pts[2][0]) + (pts[7][0] - pts[3][0]));
OutType X3y = static_cast<OutType>((pts[4][1] - pts[0][1]) + (pts[5][1] - pts[1][1]) +
(pts[6][1] - pts[2][1]) + (pts[7][1] - pts[3][1]));
OutType X3z = static_cast<OutType>((pts[4][2] - pts[0][2]) + (pts[5][2] - pts[1][2]) +
(pts[6][2] - pts[2][2]) + (pts[7][2] - pts[3][2]));
vtkm::Matrix<OutType, 3, 3> A8;
vtkm::MatrixSetRow(A8, 0, vtkm::Vec<OutType, 3>(X1x, X1y, X1z));
vtkm::MatrixSetRow(A8, 1, vtkm::Vec<OutType, 3>(X2x, X2y, X2z));

@ -107,7 +107,7 @@ VTKM_EXEC OutType CellScaledJacobianMetric(const vtkm::IdComponent& numPts,
}
// compute jacobian of triangle
Vector TriCross = vtkm::Cross(l2, l1);
Scalar scaledJacobian = vtkm::Magnitude(TriCross);
Scalar scaledJacobian = static_cast<OutType>(vtkm::Magnitude(TriCross));
//add all pieces together
//TODO change
@ -279,13 +279,13 @@ VTKM_EXEC OutType CellScaledJacobianMetric(const vtkm::IdComponent& numPts,
Edge Edges[6] = { pts[1] - pts[0], pts[2] - pts[1], pts[0] - pts[2],
pts[3] - pts[0], pts[3] - pts[1], pts[3] - pts[2] };
OutType EdgesSquared[6];
OutType jacobian = vtkm::Dot(vtkm::Cross(Edges[2], Edges[0]), Edges[3]);
OutType jacobian = static_cast<OutType>(vtkm::Dot(vtkm::Cross(Edges[2], Edges[0]), Edges[3]));
// compute the scaled jacobian
OutType currSide, maxSide = vtkm::NegativeInfinity<OutType>();
vtkm::IdComponent edgeIndex, sideIndex;
for (edgeIndex = 0; edgeIndex < 6; edgeIndex++)
{
EdgesSquared[edgeIndex] = vtkm::MagnitudeSquared(Edges[edgeIndex]);
EdgesSquared[edgeIndex] = static_cast<OutType>(vtkm::MagnitudeSquared(Edges[edgeIndex]));
}
OutType Sides[4] = { EdgesSquared[0] * EdgesSquared[2] * EdgesSquared[3],
EdgesSquared[0] * EdgesSquared[1] * EdgesSquared[4],

@ -160,12 +160,12 @@ VTKM_EXEC OutType CellShapeMetric(const vtkm::IdComponent& numPts,
const Vector l3 = GetTetraL3<Scalar, Vector, CollectionOfPoints>(pts);
const Vector negl2 = -1 * l2;
const Scalar l0l0 = vtkm::Dot(l0, l0);
const Scalar l2l2 = vtkm::Dot(l2, l2);
const Scalar l3l3 = vtkm::Dot(l3, l3);
const Scalar l0negl2 = vtkm::Dot(l0, negl2);
const Scalar l0l3 = vtkm::Dot(l0, l3);
const Scalar negl2l3 = vtkm::Dot(negl2, l3);
const Scalar l0l0 = static_cast<Scalar>(vtkm::Dot(l0, l0));
const Scalar l2l2 = static_cast<Scalar>(vtkm::Dot(l2, l2));
const Scalar l3l3 = static_cast<Scalar>(vtkm::Dot(l3, l3));
const Scalar l0negl2 = static_cast<Scalar>(vtkm::Dot(l0, negl2));
const Scalar l0l3 = static_cast<Scalar>(vtkm::Dot(l0, l3));
const Scalar negl2l3 = static_cast<Scalar>(vtkm::Dot(negl2, l3));
const Scalar numerator = three * vtkm::Pow(jacobian * rtTwo, twoThirds);
Scalar denominator = (threeHalves * (l0l0 + l2l2 + l3l3)) - (l0negl2 + l0l3 + negl2l3);

@ -63,21 +63,22 @@ VTKM_EXEC OutType CellSkewMetric(const vtkm::IdComponent& numPts,
using Scalar = OutType;
using Vector = typename PointCoordVecType::ComponentType;
Vector X1 = (pts[1] - pts[0]) + (pts[2] - pts[3]) + (pts[5] - pts[4]) + (pts[6] - pts[7]);
Scalar X1_mag = vtkm::Magnitude(X1);
if (X1_mag <= Scalar(0.0))
auto X1_mag = vtkm::Magnitude(X1);
if (Scalar(X1_mag) <= Scalar(0.0))
return vtkm::Infinity<Scalar>();
Vector x1 = X1 / X1_mag;
Vector X2 = (pts[3] - pts[0]) + (pts[2] - pts[1]) + (pts[7] - pts[4]) + (pts[6] - pts[5]);
Scalar X2_mag = vtkm::Magnitude(X2);
if (X2_mag <= Scalar(0.0))
auto X2_mag = vtkm::Magnitude(X2);
if (Scalar(X2_mag) <= Scalar(0.0))
return vtkm::Infinity<Scalar>();
Vector x2 = X2 / X2_mag;
Vector X3 = (pts[4] - pts[0]) + (pts[5] - pts[1]) + (pts[6] - pts[2]) + (pts[7] - pts[3]);
Scalar X3_mag = vtkm::Magnitude(X3);
if (X3_mag <= Scalar(0.0))
auto X3_mag = vtkm::Magnitude(X3);
if (Scalar(X3_mag) <= Scalar(0.0))
return vtkm::Infinity<Scalar>();
Vector x3 = X3 / X3_mag;
return vtkm::Max(vtkm::Dot(x1, x2), vtkm::Max(vtkm::Dot(x1, x3), vtkm::Dot(x2, x3)));
return static_cast<Scalar>(
vtkm::Max(vtkm::Dot(x1, x2), vtkm::Max(vtkm::Dot(x1, x3), vtkm::Dot(x2, x3))));
}
template <typename OutType, typename PointCoordVecType>
@ -93,14 +94,14 @@ VTKM_EXEC OutType CellSkewMetric(const vtkm::IdComponent& numPts,
using Vector = typename PointCoordVecType::ComponentType;
const Vector X0 = GetQuadX0<Scalar, Vector, CollectionOfPoints>(pts);
const Vector X1 = GetQuadX1<Scalar, Vector, CollectionOfPoints>(pts);
const Scalar X0Mag = vtkm::Magnitude(X0);
const Scalar X1Mag = vtkm::Magnitude(X1);
const auto X0Mag = vtkm::Magnitude(X0);
const auto X1Mag = vtkm::Magnitude(X1);
if (X0Mag < Scalar(0.0) || X1Mag < Scalar(0.0))
if (Scalar(X0Mag) < Scalar(0.0) || Scalar(X1Mag) < Scalar(0.0))
return Scalar(0.0);
const Vector x0Normalized = X0 / X0Mag;
const Vector x1Normalized = X1 / X1Mag;
const Scalar dot = vtkm::Dot(x0Normalized, x1Normalized);
const Scalar dot = static_cast<Scalar>(vtkm::Dot(x0Normalized, x1Normalized));
return vtkm::Abs(dot);
}
}

@ -76,9 +76,9 @@ VTKM_EXEC OutType CellTaperMetric(const vtkm::IdComponent& numPts,
const Vector X1 = GetQuadX0<Scalar, Vector, CollectionOfPoints>(pts);
const Vector X2 = GetQuadX1<Scalar, Vector, CollectionOfPoints>(pts);
const Scalar x12 = vtkm::Sqrt(vtkm::MagnitudeSquared(X12));
const Scalar x1 = vtkm::Sqrt(vtkm::MagnitudeSquared(X1));
const Scalar x2 = vtkm::Sqrt(vtkm::MagnitudeSquared(X2));
const Scalar x12 = static_cast<Scalar>(vtkm::Sqrt(vtkm::MagnitudeSquared(X12)));
const Scalar x1 = static_cast<Scalar>(vtkm::Sqrt(vtkm::MagnitudeSquared(X1)));
const Scalar x2 = static_cast<Scalar>(vtkm::Sqrt(vtkm::MagnitudeSquared(X2)));
const Scalar minLength = vtkm::Min(x1, x2);
if (minLength <= Scalar(0.0))
@ -102,22 +102,22 @@ VTKM_EXEC OutType CellTaperMetric(const vtkm::IdComponent& numPts,
UNUSED(ec);
using Scalar = OutType;
Scalar X1 = vtkm::Sqrt(vtkm::MagnitudeSquared((pts[1] - pts[0]) + (pts[2] - pts[3]) +
(pts[5] - pts[4]) + (pts[6] - pts[7])));
Scalar X2 = vtkm::Sqrt(vtkm::MagnitudeSquared((pts[3] - pts[0]) + (pts[2] - pts[1]) +
(pts[7] - pts[4]) + (pts[6] - pts[5])));
Scalar X3 = vtkm::Sqrt(vtkm::MagnitudeSquared((pts[4] - pts[0]) + (pts[5] - pts[1]) +
(pts[6] - pts[2]) + (pts[7] - pts[3])));
Scalar X1 = static_cast<Scalar>(vtkm::Sqrt(vtkm::MagnitudeSquared(
(pts[1] - pts[0]) + (pts[2] - pts[3]) + (pts[5] - pts[4]) + (pts[6] - pts[7]))));
Scalar X2 = static_cast<Scalar>(vtkm::Sqrt(vtkm::MagnitudeSquared(
(pts[3] - pts[0]) + (pts[2] - pts[1]) + (pts[7] - pts[4]) + (pts[6] - pts[5]))));
Scalar X3 = static_cast<Scalar>(vtkm::Sqrt(vtkm::MagnitudeSquared(
(pts[4] - pts[0]) + (pts[5] - pts[1]) + (pts[6] - pts[2]) + (pts[7] - pts[3]))));
if ((X1 <= Scalar(0.0)) || (X2 <= Scalar(0.0)) || (X3 <= Scalar(0.0)))
{
return vtkm::Infinity<Scalar>();
}
Scalar X12 = vtkm::Sqrt(vtkm::MagnitudeSquared(((pts[2] - pts[3]) - (pts[1] - pts[0])) +
((pts[6] - pts[7]) - (pts[5] - pts[4]))));
Scalar X13 = vtkm::Sqrt(vtkm::MagnitudeSquared(((pts[5] - pts[1]) - (pts[4] - pts[0])) +
((pts[6] - pts[2]) - (pts[7] - pts[3]))));
Scalar X23 = vtkm::Sqrt(vtkm::MagnitudeSquared(((pts[7] - pts[4]) - (pts[3] - pts[0])) +
((pts[6] - pts[5]) - (pts[2] - pts[1]))));
Scalar X12 = static_cast<Scalar>(vtkm::Sqrt(vtkm::MagnitudeSquared(
((pts[2] - pts[3]) - (pts[1] - pts[0])) + ((pts[6] - pts[7]) - (pts[5] - pts[4])))));
Scalar X13 = static_cast<Scalar>(vtkm::Sqrt(vtkm::MagnitudeSquared(
((pts[5] - pts[1]) - (pts[4] - pts[0])) + ((pts[6] - pts[2]) - (pts[7] - pts[3])))));
Scalar X23 = static_cast<Scalar>(vtkm::Sqrt(vtkm::MagnitudeSquared(
((pts[7] - pts[4]) - (pts[3] - pts[0])) + ((pts[6] - pts[5]) - (pts[2] - pts[1])))));
Scalar T12 = X12 / vtkm::Min(X1, X2);
Scalar T13 = X13 / vtkm::Min(X1, X3);
Scalar T23 = X23 / vtkm::Min(X2, X3);

@ -67,8 +67,8 @@ VTKM_EXEC OutType CellWarpageMetric(const vtkm::IdComponent& numPts,
if (N0Mag < Scalar(0.0) || N1Mag < Scalar(0.0) || N2Mag < Scalar(0.0) || N3Mag < Scalar(0.0))
return vtkm::Infinity<Scalar>();
const Scalar n0dotn2 = vtkm::Dot(N0Mag, N2Mag);
const Scalar n1dotn3 = vtkm::Dot(N1Mag, N3Mag);
const Scalar n0dotn2 = static_cast<Scalar>(vtkm::Dot(N0Mag, N2Mag));
const Scalar n1dotn3 = static_cast<Scalar>(vtkm::Dot(N1Mag, N3Mag));
const Scalar min = vtkm::Min(n0dotn2, n1dotn3);
const Scalar minCubed = vtkm::Pow(min, 3);

@ -195,8 +195,8 @@ VTKM_EXEC Vector GetHexL11(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetHexL0Magnitude(const CollectionOfPoints& pts)
{
const Scalar l0 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL0<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l0 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL0<Scalar, Vector, CollectionOfPoints>(pts))));
return l0;
}
/**
@ -208,8 +208,8 @@ VTKM_EXEC Scalar GetHexL0Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetHexL1Magnitude(const CollectionOfPoints& pts)
{
const Scalar l1 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL1<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l1 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL1<Scalar, Vector, CollectionOfPoints>(pts))));
return l1;
}
/**
@ -221,8 +221,8 @@ VTKM_EXEC Scalar GetHexL1Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetHexL2Magnitude(const CollectionOfPoints& pts)
{
const Scalar l2 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL2<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l2 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL2<Scalar, Vector, CollectionOfPoints>(pts))));
return l2;
}
/**
@ -234,8 +234,8 @@ VTKM_EXEC Scalar GetHexL2Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetHexL3Magnitude(const CollectionOfPoints& pts)
{
const Scalar l3 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL3<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l3 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL3<Scalar, Vector, CollectionOfPoints>(pts))));
return l3;
}
/**
@ -247,8 +247,8 @@ VTKM_EXEC Scalar GetHexL3Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetHexL4Magnitude(const CollectionOfPoints& pts)
{
const Scalar l4 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL4<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l4 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL4<Scalar, Vector, CollectionOfPoints>(pts))));
return l4;
}
/**
@ -260,8 +260,8 @@ VTKM_EXEC Scalar GetHexL4Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetHexL5Magnitude(const CollectionOfPoints& pts)
{
const Scalar l5 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL5<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l5 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL5<Scalar, Vector, CollectionOfPoints>(pts))));
return l5;
}
/**
@ -273,8 +273,8 @@ VTKM_EXEC Scalar GetHexL5Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetHexL6Magnitude(const CollectionOfPoints& pts)
{
const Scalar l6 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL6<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l6 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL6<Scalar, Vector, CollectionOfPoints>(pts))));
return l6;
}
/**
@ -286,8 +286,8 @@ VTKM_EXEC Scalar GetHexL6Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetHexL7Magnitude(const CollectionOfPoints& pts)
{
const Scalar l7 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL7<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l7 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL7<Scalar, Vector, CollectionOfPoints>(pts))));
return l7;
}
/**
@ -299,8 +299,8 @@ VTKM_EXEC Scalar GetHexL7Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetHexL8Magnitude(const CollectionOfPoints& pts)
{
const Scalar l8 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL8<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l8 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL8<Scalar, Vector, CollectionOfPoints>(pts))));
return l8;
}
/**
@ -312,8 +312,8 @@ VTKM_EXEC Scalar GetHexL8Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetHexL9Magnitude(const CollectionOfPoints& pts)
{
const Scalar l9 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL9<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l9 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL9<Scalar, Vector, CollectionOfPoints>(pts))));
return l9;
}
/**
@ -325,8 +325,8 @@ VTKM_EXEC Scalar GetHexL9Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetHexL10Magnitude(const CollectionOfPoints& pts)
{
const Scalar l10 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL10<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l10 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL10<Scalar, Vector, CollectionOfPoints>(pts))));
return l10;
}
/**
@ -338,8 +338,8 @@ VTKM_EXEC Scalar GetHexL10Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetHexL11Magnitude(const CollectionOfPoints& pts)
{
const Scalar l11 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL11<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l11 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexL11<Scalar, Vector, CollectionOfPoints>(pts))));
return l11;
}
/**
@ -481,8 +481,8 @@ VTKM_EXEC Vector GetHexD3(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetHexD0Magnitude(const CollectionOfPoints& pts)
{
const Scalar d0 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexD0<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar d0 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexD0<Scalar, Vector, CollectionOfPoints>(pts))));
return d0;
}
@ -495,8 +495,8 @@ VTKM_EXEC Scalar GetHexD0Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetHexD1Magnitude(const CollectionOfPoints& pts)
{
const Scalar d1 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexD1<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar d1 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexD1<Scalar, Vector, CollectionOfPoints>(pts))));
return d1;
}
@ -509,8 +509,8 @@ VTKM_EXEC Scalar GetHexD1Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetHexD2Magnitude(const CollectionOfPoints& pts)
{
const Scalar d2 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexD2<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar d2 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexD2<Scalar, Vector, CollectionOfPoints>(pts))));
return d2;
}
@ -523,8 +523,8 @@ VTKM_EXEC Scalar GetHexD2Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetHexD3Magnitude(const CollectionOfPoints& pts)
{
const Scalar d3 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexD3<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar d3 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetHexD3<Scalar, Vector, CollectionOfPoints>(pts))));
return d3;
}
@ -701,9 +701,9 @@ template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetHexAiNormSquared(const CollectionOfPoints& pts, const vtkm::Id& index)
{
const vtkm::Vec<Vector, 3> Ai = GetHexAi<Scalar, Vector, CollectionOfPoints>(pts, index);
const Scalar magSquared0 = vtkm::MagnitudeSquared(Ai[0]);
const Scalar magSquared1 = vtkm::MagnitudeSquared(Ai[1]);
const Scalar magSquared2 = vtkm::MagnitudeSquared(Ai[2]);
const Scalar magSquared0 = static_cast<Scalar>(vtkm::MagnitudeSquared(Ai[0]));
const Scalar magSquared1 = static_cast<Scalar>(vtkm::MagnitudeSquared(Ai[1]));
const Scalar magSquared2 = static_cast<Scalar>(vtkm::MagnitudeSquared(Ai[2]));
const Scalar AiNormSquared = magSquared0 + magSquared1 + magSquared2;
@ -721,9 +721,9 @@ template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetHexAiAdjNormSquared(const CollectionOfPoints& pts, const vtkm::Id& index)
{
const vtkm::Vec<Vector, 3> Ai = GetHexAi<Scalar, Vector, CollectionOfPoints>(pts, index);
const Scalar magSquared0 = vtkm::MagnitudeSquared(vtkm::Cross(Ai[0], Ai[1]));
const Scalar magSquared1 = vtkm::MagnitudeSquared(vtkm::Cross(Ai[1], Ai[2]));
const Scalar magSquared2 = vtkm::MagnitudeSquared(vtkm::Cross(Ai[2], Ai[0]));
const Scalar magSquared0 = static_cast<Scalar>(vtkm::MagnitudeSquared(vtkm::Cross(Ai[0], Ai[1])));
const Scalar magSquared1 = static_cast<Scalar>(vtkm::MagnitudeSquared(vtkm::Cross(Ai[1], Ai[2])));
const Scalar magSquared2 = static_cast<Scalar>(vtkm::MagnitudeSquared(vtkm::Cross(Ai[2], Ai[0])));
const Scalar AiAdjNormSquared = magSquared0 + magSquared1 + magSquared2;
@ -741,7 +741,7 @@ template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetHexAlphai(const CollectionOfPoints& pts, const vtkm::Id& index)
{
const vtkm::Vec<Vector, 3> Ai = GetHexAi<Scalar, Vector, CollectionOfPoints>(pts, index);
const Scalar alpha_i = vtkm::Dot(Ai[0], vtkm::Cross(Ai[1], Ai[2]));
const Scalar alpha_i = static_cast<Scalar>(vtkm::Dot(Ai[0], vtkm::Cross(Ai[1], Ai[2])));
return alpha_i;
}
@ -775,7 +775,7 @@ template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetHexAlphaiHat(const CollectionOfPoints& pts, const vtkm::Id& index)
{
const vtkm::Vec<Vector, 3> Ai = GetHexAiHat<Scalar, Vector, CollectionOfPoints>(pts, index);
const Scalar hatAlpha_i = vtkm::Dot(Ai[0], vtkm::Cross(Ai[1], Ai[2]));
const Scalar hatAlpha_i = static_cast<Scalar>(vtkm::Dot(Ai[0], vtkm::Cross(Ai[1], Ai[2])));
return hatAlpha_i;
}

@ -93,8 +93,8 @@ VTKM_EXEC Vector GetQuadL3(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetQuadL0Magnitude(const CollectionOfPoints& pts)
{
const Scalar l0 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetQuadL0<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l0 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetQuadL0<Scalar, Vector, CollectionOfPoints>(pts))));
return l0;
}
@ -107,8 +107,8 @@ VTKM_EXEC Scalar GetQuadL0Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetQuadL1Magnitude(const CollectionOfPoints& pts)
{
const Scalar l1 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetQuadL1<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l1 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetQuadL1<Scalar, Vector, CollectionOfPoints>(pts))));
return l1;
}
@ -121,8 +121,8 @@ VTKM_EXEC Scalar GetQuadL1Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetQuadL2Magnitude(const CollectionOfPoints& pts)
{
const Scalar l2 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetQuadL2<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l2 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetQuadL2<Scalar, Vector, CollectionOfPoints>(pts))));
return l2;
}
@ -135,8 +135,8 @@ VTKM_EXEC Scalar GetQuadL2Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetQuadL3Magnitude(const CollectionOfPoints& pts)
{
const Scalar l3 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetQuadL3<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l3 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetQuadL3<Scalar, Vector, CollectionOfPoints>(pts))));
return l3;
}
@ -209,8 +209,8 @@ VTKM_EXEC Vector GetQuadD1(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetQuadD0Magnitude(const CollectionOfPoints& pts)
{
const Scalar d0 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetQuadD0<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar d0 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetQuadD0<Scalar, Vector, CollectionOfPoints>(pts))));
return d0;
}
@ -223,8 +223,8 @@ VTKM_EXEC Scalar GetQuadD0Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetQuadD1Magnitude(const CollectionOfPoints& pts)
{
const Scalar d1 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetQuadD1<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar d1 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetQuadD1<Scalar, Vector, CollectionOfPoints>(pts))));
return d1;
}
@ -417,7 +417,7 @@ VTKM_EXEC Scalar GetQuadAlpha0(const CollectionOfPoints& pts)
const Vector normalizedCenterNormal =
GetQuadNcNormalized<Scalar, Vector, CollectionOfPoints>(pts);
const Vector N0 = GetQuadN0<Scalar, Vector, CollectionOfPoints>(pts);
return vtkm::Dot(normalizedCenterNormal, N0);
return static_cast<Scalar>(vtkm::Dot(normalizedCenterNormal, N0));
}
/**
@ -432,7 +432,7 @@ VTKM_EXEC Scalar GetQuadAlpha1(const CollectionOfPoints& pts)
const Vector normalizedCenterNormal =
GetQuadNcNormalized<Scalar, Vector, CollectionOfPoints>(pts);
const Vector N1 = GetQuadN1<Scalar, Vector, CollectionOfPoints>(pts);
return vtkm::Dot(normalizedCenterNormal, N1);
return static_cast<Scalar>(vtkm::Dot(normalizedCenterNormal, N1));
}
/**
@ -447,7 +447,7 @@ VTKM_EXEC Scalar GetQuadAlpha2(const CollectionOfPoints& pts)
const Vector normalizedCenterNormal =
GetQuadNcNormalized<Scalar, Vector, CollectionOfPoints>(pts);
const Vector N2 = GetQuadN2<Scalar, Vector, CollectionOfPoints>(pts);
return vtkm::Dot(normalizedCenterNormal, N2);
return static_cast<Scalar>(vtkm::Dot(normalizedCenterNormal, N2));
}
@ -463,7 +463,7 @@ VTKM_EXEC Scalar GetQuadAlpha3(const CollectionOfPoints& pts)
const Vector normalizedCenterNormal =
GetQuadNcNormalized<Scalar, Vector, CollectionOfPoints>(pts);
const Vector N3 = GetQuadN3<Scalar, Vector, CollectionOfPoints>(pts);
return vtkm::Dot(normalizedCenterNormal, N3);
return static_cast<Scalar>(vtkm::Dot(normalizedCenterNormal, N3));
}

@ -106,8 +106,8 @@ VTKM_EXEC Vector GetTetraL5(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetTetraL0Magnitude(const CollectionOfPoints& pts)
{
const Scalar l0 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetTetraL0<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l0 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetTetraL0<Scalar, Vector, CollectionOfPoints>(pts))));
return l0;
}
@ -120,8 +120,8 @@ VTKM_EXEC Scalar GetTetraL0Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetTetraL1Magnitude(const CollectionOfPoints& pts)
{
const Scalar l1 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetTetraL1<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l1 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetTetraL1<Scalar, Vector, CollectionOfPoints>(pts))));
return l1;
}
@ -134,8 +134,8 @@ VTKM_EXEC Scalar GetTetraL1Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetTetraL2Magnitude(const CollectionOfPoints& pts)
{
const Scalar l2 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetTetraL2<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l2 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetTetraL2<Scalar, Vector, CollectionOfPoints>(pts))));
return l2;
}
@ -148,8 +148,8 @@ VTKM_EXEC Scalar GetTetraL2Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetTetraL3Magnitude(const CollectionOfPoints& pts)
{
const Scalar l3 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetTetraL3<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l3 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetTetraL3<Scalar, Vector, CollectionOfPoints>(pts))));
return l3;
}
@ -162,8 +162,8 @@ VTKM_EXEC Scalar GetTetraL3Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetTetraL4Magnitude(const CollectionOfPoints& pts)
{
const Scalar l4 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetTetraL4<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l4 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetTetraL4<Scalar, Vector, CollectionOfPoints>(pts))));
return l4;
}
@ -176,8 +176,8 @@ VTKM_EXEC Scalar GetTetraL4Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetTetraL5Magnitude(const CollectionOfPoints& pts)
{
const Scalar l5 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetTetraL5<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l5 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetTetraL5<Scalar, Vector, CollectionOfPoints>(pts))));
return l5;
}
@ -234,10 +234,10 @@ VTKM_EXEC Scalar GetTetraArea(const CollectionOfPoints& pts)
const Vector L3 = GetTetraL3<Scalar, Vector, CollectionOfPoints>(pts);
const Vector L4 = GetTetraL4<Scalar, Vector, CollectionOfPoints>(pts);
const Scalar a = vtkm::Sqrt(vtkm::MagnitudeSquared(vtkm::Cross(L2, L0)));
const Scalar b = vtkm::Sqrt(vtkm::MagnitudeSquared(vtkm::Cross(L3, L0)));
const Scalar c = vtkm::Sqrt(vtkm::MagnitudeSquared(vtkm::Cross(L4, L1)));
const Scalar d = vtkm::Sqrt(vtkm::MagnitudeSquared(vtkm::Cross(L3, L2)));
const Scalar a = static_cast<Scalar>(vtkm::Sqrt(vtkm::MagnitudeSquared(vtkm::Cross(L2, L0))));
const Scalar b = static_cast<Scalar>(vtkm::Sqrt(vtkm::MagnitudeSquared(vtkm::Cross(L3, L0))));
const Scalar c = static_cast<Scalar>(vtkm::Sqrt(vtkm::MagnitudeSquared(vtkm::Cross(L4, L1))));
const Scalar d = static_cast<Scalar>(vtkm::Sqrt(vtkm::MagnitudeSquared(vtkm::Cross(L3, L2))));
const Scalar hhalf(0.5);
const Scalar area = hhalf * (a + b + c + d);
@ -258,7 +258,7 @@ VTKM_EXEC Scalar GetTetraVolume(const CollectionOfPoints& pts)
const Vector L3 = GetTetraL3<Scalar, Vector, CollectionOfPoints>(pts);
const Scalar six(6.0);
return vtkm::Dot(vtkm::Cross(L2, L0), L3) / six;
return static_cast<Scalar>(vtkm::Dot(vtkm::Cross(L2, L0), L3)) / six;
}
/**

@ -81,8 +81,8 @@ VTKM_EXEC Vector GetTriangleL2(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetTriangleL0Magnitude(const CollectionOfPoints& pts)
{
const Scalar l0 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetTriangleL0<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l0 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetTriangleL0<Scalar, Vector, CollectionOfPoints>(pts))));
return l0;
}
@ -95,8 +95,8 @@ VTKM_EXEC Scalar GetTriangleL0Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetTriangleL1Magnitude(const CollectionOfPoints& pts)
{
const Scalar l1 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetTriangleL1<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l1 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetTriangleL1<Scalar, Vector, CollectionOfPoints>(pts))));
return l1;
}
@ -109,8 +109,8 @@ VTKM_EXEC Scalar GetTriangleL1Magnitude(const CollectionOfPoints& pts)
template <typename Scalar, typename Vector, typename CollectionOfPoints>
VTKM_EXEC Scalar GetTriangleL2Magnitude(const CollectionOfPoints& pts)
{
const Scalar l2 =
vtkm::Sqrt(vtkm::MagnitudeSquared(GetTriangleL2<Scalar, Vector, CollectionOfPoints>(pts)));
const Scalar l2 = static_cast<Scalar>(
vtkm::Sqrt(vtkm::MagnitudeSquared(GetTriangleL2<Scalar, Vector, CollectionOfPoints>(pts))));
return l2;
}
@ -165,7 +165,8 @@ VTKM_EXEC Scalar GetTriangleArea(const CollectionOfPoints& pts)
const Vector L0 = GetTriangleL0<Scalar, Vector, CollectionOfPoints>(pts);
const Vector L1 = GetTriangleL1<Scalar, Vector, CollectionOfPoints>(pts);
const Scalar hhalf(0.5);
const Scalar crossProductMagnitude = vtkm::Sqrt(vtkm::MagnitudeSquared(vtkm::Cross(L0, L1)));
const Scalar crossProductMagnitude =
static_cast<Scalar>(vtkm::Sqrt(vtkm::MagnitudeSquared(vtkm::Cross(L0, L1))));
const Scalar area = hhalf * crossProductMagnitude;
return area;
}