mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Less verbose unit tests.
This commit is contained in:
parent
f85e27c7f1
commit
3b2c103397
@ -435,9 +435,6 @@ private:
|
||||
auto composite =
|
||||
vtkm::cont::make_ArrayHandleCompositeVector(compositeInput, compositeInput, compositeInput);
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(composite, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<ValueType, 3>> result;
|
||||
|
||||
vtkm::worklet::DispatcherMapField<PassThrough> dispatcher;
|
||||
@ -473,9 +470,6 @@ private:
|
||||
vtkm::worklet::DispatcherMapField<PassThrough> dispatcher;
|
||||
dispatcher.Invoke(constant, result);
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(constant, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
//verify that the control portal works
|
||||
auto resultPortal = result.ReadPortal();
|
||||
auto constantPortal = constant.ReadPortal();
|
||||
@ -510,9 +504,6 @@ private:
|
||||
vtkm::worklet::DispatcherMapField<PassThrough> dispatcher;
|
||||
dispatcher.Invoke(counting, result);
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(counting, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
//verify that the control portal works
|
||||
auto resultPortal = result.ReadPortal();
|
||||
auto countingPortal = counting.ReadPortal();
|
||||
@ -540,9 +531,6 @@ private:
|
||||
vtkm::cont::ArrayHandleImplicit<FunctorType> implicit =
|
||||
vtkm::cont::make_ArrayHandleImplicit(functor, length);
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(implicit, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
vtkm::cont::ArrayHandle<ValueType> result;
|
||||
|
||||
vtkm::worklet::DispatcherMapField<PassThrough> dispatcher;
|
||||
@ -595,8 +583,6 @@ private:
|
||||
|
||||
// concatenate two arrays together
|
||||
ConcatenateType concatenate = vtkm::cont::make_ArrayHandleConcatenate(implicit, basic);
|
||||
vtkm::cont::printSummary_ArrayHandle(concatenate, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
vtkm::cont::ArrayHandle<ValueType> result;
|
||||
|
||||
@ -653,8 +639,6 @@ private:
|
||||
PermutationHandleType permutation =
|
||||
vtkm::cont::make_ArrayHandlePermutation(counting, implicit);
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(permutation, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
vtkm::cont::ArrayHandle<ValueType> result;
|
||||
|
||||
@ -702,9 +686,6 @@ private:
|
||||
ViewHandleType view =
|
||||
vtkm::cont::make_ArrayHandleView(implicit, start_pos, counting_length);
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(view, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
vtkm::cont::ArrayHandle<ValueType> result;
|
||||
|
||||
vtkm::worklet::DispatcherMapField<PassThrough> dispatcher;
|
||||
@ -746,9 +727,6 @@ private:
|
||||
input.Allocate(length);
|
||||
SetPortal(input.WritePortal());
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(transformed, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
vtkm::cont::ArrayHandle<ValueType> result;
|
||||
|
||||
vtkm::worklet::DispatcherMapField<PassThrough> dispatcher;
|
||||
@ -786,9 +764,6 @@ private:
|
||||
input.Allocate(length);
|
||||
SetPortal(input.WritePortal());
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(transformed, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
vtkm::cont::ArrayHandle<ValueType> result;
|
||||
|
||||
vtkm::worklet::DispatcherMapField<PassThrough> dispatcher;
|
||||
@ -830,9 +805,6 @@ private:
|
||||
vtkm::cont::ArrayHandleTransform<vtkm::cont::ArrayHandleCounting<ValueType>, FunctorType>
|
||||
countingTransformed = vtkm::cont::make_ArrayHandleTransform(counting, functor);
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(countingTransformed, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
vtkm::cont::ArrayHandle<OutputValueType> result;
|
||||
|
||||
vtkm::worklet::DispatcherMapField<PassThrough> dispatcher;
|
||||
@ -869,9 +841,6 @@ private:
|
||||
vtkm::worklet::DispatcherMapField<PassThrough> dispatcher;
|
||||
dispatcher.Invoke(castArray, result);
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(castArray, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
// verify results
|
||||
vtkm::Id length = ARRAY_SIZE;
|
||||
auto resultPortal = result.ReadPortal();
|
||||
@ -901,9 +870,6 @@ private:
|
||||
vtkm::worklet::DispatcherMapField<PassThrough> dispatcher;
|
||||
dispatcher.Invoke(input, castArray);
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(castArray, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
// verify results
|
||||
vtkm::Id length = ARRAY_SIZE;
|
||||
auto inputPortal = input.ReadPortal();
|
||||
@ -935,9 +901,6 @@ private:
|
||||
|
||||
this->Invoke(PassThrough{}, multiplexArray, result);
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(multiplexArray, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
// verify results
|
||||
VTKM_TEST_ASSERT(test_equal_portals(result.ReadPortal(), input.ReadPortal()),
|
||||
"CastingArrayHandle failed");
|
||||
@ -963,9 +926,6 @@ private:
|
||||
|
||||
this->Invoke(PassThrough{}, input, multiplexerArray);
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(multiplexerArray, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
// verify results
|
||||
VTKM_TEST_ASSERT(test_equal_portals(input.ReadPortal(), result.ReadPortal()),
|
||||
"Multiplexing ArrayHandle failed");
|
||||
@ -989,9 +949,6 @@ private:
|
||||
VTKM_TEST_ASSERT(groupArray.GetNumberOfValues() == ARRAY_SIZE,
|
||||
"Group array reporting wrong array size.");
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(groupArray, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
vtkm::cont::ArrayHandle<ValueType> resultArray;
|
||||
|
||||
vtkm::worklet::DispatcherMapField<PassThrough> dispatcher;
|
||||
@ -1037,11 +994,6 @@ private:
|
||||
vtkm::worklet::DispatcherMapField<PassThrough> dispatcher;
|
||||
dispatcher.Invoke(baseArray, groupArray);
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(groupArray, std::cout);
|
||||
std::cout << std::endl;
|
||||
vtkm::cont::printSummary_ArrayHandle(resultArray, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
VTKM_TEST_ASSERT(groupArray.GetNumberOfValues() == ARRAY_SIZE,
|
||||
"Group array reporting wrong array size.");
|
||||
|
||||
@ -1113,10 +1065,6 @@ private:
|
||||
sourceArray.Allocate(sourceArraySize);
|
||||
SetPortal(sourceArray.WritePortal());
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(
|
||||
vtkm::cont::make_ArrayHandleGroupVecVariable(sourceArray, offsetsArray), std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> dummyArray;
|
||||
|
||||
vtkm::worklet::DispatcherMapField<GroupVariableInputWorklet> dispatcher;
|
||||
@ -1172,12 +1120,6 @@ private:
|
||||
dispatcher.Invoke(vtkm::cont::ArrayHandleIndex(ARRAY_SIZE),
|
||||
vtkm::cont::make_ArrayHandleGroupVecVariable(sourceArray, offsetsArray));
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(
|
||||
vtkm::cont::make_ArrayHandleGroupVecVariable(sourceArray, offsetsArray), std::cout);
|
||||
std::cout << std::endl;
|
||||
vtkm::cont::printSummary_ArrayHandle(sourceArray, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
CheckPortal(sourceArray.ReadPortal());
|
||||
}
|
||||
};
|
||||
@ -1208,9 +1150,6 @@ private:
|
||||
vtkm::cont::ArrayHandle<ValueType>>
|
||||
zip = vtkm::cont::make_ArrayHandleZip(keys, values);
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(zip, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
vtkm::cont::ArrayHandle<PairType> result;
|
||||
|
||||
vtkm::worklet::DispatcherMapField<PassThrough> dispatcher;
|
||||
@ -1276,9 +1215,6 @@ private:
|
||||
vtkm::worklet::DispatcherMapField<PassThrough> dispatcher;
|
||||
dispatcher.Invoke(input, permutation);
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(permutation, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
//verify that the control portal works
|
||||
CheckPortal(permutation.ReadPortal());
|
||||
}
|
||||
@ -1305,9 +1241,6 @@ private:
|
||||
vtkm::worklet::DispatcherMapField<PassThrough> dispatcher;
|
||||
dispatcher.Invoke(input, view);
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(view, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
//verify that the control portal works
|
||||
CheckPortal(view.ReadPortal());
|
||||
}
|
||||
@ -1335,8 +1268,6 @@ private:
|
||||
vtkm::worklet::DispatcherMapField<PassThrough> dispatcher;
|
||||
dispatcher.Invoke(input, transformed);
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(transformed, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
//verify that the control portal works
|
||||
auto outputPortal = output.ReadPortal();
|
||||
@ -1381,9 +1312,6 @@ private:
|
||||
vtkm::worklet::DispatcherMapField<PassThrough> dispatcher;
|
||||
dispatcher.Invoke(input, transformed);
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(transformed, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
//verify that the control portal works
|
||||
auto outputPortal = output.ReadPortal();
|
||||
auto transformedPortal = transformed.ReadPortal();
|
||||
@ -1426,9 +1354,6 @@ private:
|
||||
vtkm::worklet::DispatcherMapField<PassThrough> dispatcher;
|
||||
dispatcher.Invoke(input, result_zip);
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(result_zip, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
//now the two arrays we have zipped should have data inside them
|
||||
auto keysPortal = result_keys.ReadPortal();
|
||||
auto valsPortal = result_values.ReadPortal();
|
||||
@ -1461,9 +1386,6 @@ private:
|
||||
vtkm::worklet::DispatcherMapField<InplaceFunctorPair> dispatcher;
|
||||
dispatcher.Invoke(vtkm::cont::make_ArrayHandleZip(inputValues, outputValues));
|
||||
|
||||
vtkm::cont::printSummary_ArrayHandle(outputValues, std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
CheckPortal(outputValues.ReadPortal());
|
||||
}
|
||||
};
|
||||
|
@ -104,8 +104,6 @@ struct TestDerivativeFunctor
|
||||
fieldValues.Append(value);
|
||||
}
|
||||
|
||||
std::cout << " Expected: " << expectedGradient << std::endl;
|
||||
|
||||
std::uniform_real_distribution<vtkm::FloatDefault> randomDist;
|
||||
|
||||
for (vtkm::IdComponent trial = 0; trial < 5; trial++)
|
||||
@ -124,13 +122,10 @@ struct TestDerivativeFunctor
|
||||
}
|
||||
pcoords = (1 / totalWeight) * pcoords;
|
||||
|
||||
std::cout << " Test derivative at " << pcoords << std::endl;
|
||||
|
||||
vtkm::Vec<FieldType, 3> computedGradient;
|
||||
CHECK_CALL(vtkm::exec::CellDerivative(
|
||||
fieldValues, worldCoordinates, pcoords, shape, computedGradient));
|
||||
|
||||
std::cout << " Computed: " << computedGradient << std::endl;
|
||||
// Note that some gradients (particularly those near the center of
|
||||
// polygons with 5 or more points) are not very precise. Thus the
|
||||
// tolarance of the test_equal is raised.
|
||||
@ -174,7 +169,6 @@ struct TestDerivativeFunctor
|
||||
topDim = numPoints - 1;
|
||||
}
|
||||
|
||||
std::cout << "Simple field, " << numPoints << " points" << std::endl;
|
||||
for (vtkm::IdComponent fieldComponent = 0;
|
||||
fieldComponent < FieldTraits::GetNumberOfComponents(FieldType());
|
||||
fieldComponent++)
|
||||
@ -187,7 +181,6 @@ struct TestDerivativeFunctor
|
||||
expectedGradient[2] = ((topDim > 2) ? field.Gradient[2] : FieldType(0));
|
||||
this->DoTest(shape, numPoints, field, expectedGradient);
|
||||
|
||||
std::cout << "Uneven gradient, " << numPoints << " points" << std::endl;
|
||||
for (vtkm::IdComponent fieldComponent = 0;
|
||||
fieldComponent < FieldTraits::GetNumberOfComponents(FieldType());
|
||||
fieldComponent++)
|
||||
@ -200,7 +193,6 @@ struct TestDerivativeFunctor
|
||||
expectedGradient[2] = ((topDim > 2) ? field.Gradient[2] : FieldType(0));
|
||||
this->DoTest(shape, numPoints, field, expectedGradient);
|
||||
|
||||
std::cout << "Negative gradient directions, " << numPoints << " points" << std::endl;
|
||||
for (vtkm::IdComponent fieldComponent = 0;
|
||||
fieldComponent < FieldTraits::GetNumberOfComponents(FieldType());
|
||||
fieldComponent++)
|
||||
@ -213,7 +205,6 @@ struct TestDerivativeFunctor
|
||||
expectedGradient[2] = ((topDim > 2) ? field.Gradient[2] : FieldType(0));
|
||||
this->DoTest(shape, numPoints, field, expectedGradient);
|
||||
|
||||
std::cout << "Random linear field, " << numPoints << " points" << std::endl;
|
||||
std::uniform_real_distribution<FieldComponentType> randomDist(-20.0f, 20.0f);
|
||||
for (vtkm::IdComponent fieldComponent = 0;
|
||||
fieldComponent < FieldTraits::GetNumberOfComponents(FieldType());
|
||||
@ -262,7 +253,6 @@ struct TestDerivativeFunctor
|
||||
void TestDerivative()
|
||||
{
|
||||
vtkm::UInt32 seed = static_cast<vtkm::UInt32>(std::time(nullptr));
|
||||
std::cout << "Seed: " << seed << std::endl;
|
||||
g_RandomGenerator.seed(seed);
|
||||
|
||||
std::cout << "======== Float32 ==========================" << std::endl;
|
||||
|
@ -66,7 +66,6 @@ struct TestInterpolateFunctor
|
||||
}
|
||||
averageValue = static_cast<ComponentType>(1.0 / numPoints) * averageValue;
|
||||
|
||||
std::cout << " Test interpolated value at each cell node." << std::endl;
|
||||
for (vtkm::IdComponent pointIndex = 0; pointIndex < numPoints; pointIndex++)
|
||||
{
|
||||
vtkm::Vec3f pcoord;
|
||||
@ -80,13 +79,11 @@ struct TestInterpolateFunctor
|
||||
|
||||
if (numPoints > 0)
|
||||
{
|
||||
std::cout << " Test interpolated value at cell center." << std::endl;
|
||||
vtkm::Vec3f pcoord;
|
||||
CHECK_CALL(vtkm::exec::ParametricCoordinatesCenter(numPoints, shape, pcoord));
|
||||
FieldType interpolatedValue;
|
||||
CHECK_CALL(vtkm::exec::CellInterpolate(fieldValues, pcoord, shape, interpolatedValue));
|
||||
|
||||
std::cout << "AVG= " << averageValue << " interp= " << interpolatedValue << std::endl;
|
||||
VTKM_TEST_ASSERT(test_equal(averageValue, interpolatedValue),
|
||||
"Interpolation at center not average value.");
|
||||
}
|
||||
@ -113,18 +110,14 @@ struct TestInterpolateFunctor
|
||||
GetMinMaxPoints(
|
||||
CellShapeTag(), typename vtkm::CellTraits<CellShapeTag>::IsSizeFixed(), minPoints, maxPoints);
|
||||
|
||||
std::cout << "--- Test shape tag directly" << std::endl;
|
||||
for (vtkm::IdComponent numPoints = minPoints; numPoints <= maxPoints; numPoints++)
|
||||
{
|
||||
std::cout << numPoints << " points" << std::endl;
|
||||
this->DoTest(CellShapeTag(), numPoints);
|
||||
}
|
||||
|
||||
std::cout << "--- Test generic shape tag" << std::endl;
|
||||
vtkm::CellShapeTagGeneric genericShape(CellShapeTag::Id);
|
||||
for (vtkm::IdComponent numPoints = minPoints; numPoints <= maxPoints; numPoints++)
|
||||
{
|
||||
std::cout << numPoints << " points" << std::endl;
|
||||
this->DoTest(genericShape, numPoints);
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,6 @@ void TestPCoordsSpecial(const PointWCoordsType& pointWCoords, CellShapeTag shape
|
||||
|
||||
const vtkm::IdComponent numPoints = pointWCoords.GetNumberOfComponents();
|
||||
|
||||
std::cout << " Test parametric coordinates at cell nodes." << std::endl;
|
||||
for (vtkm::IdComponent pointIndex = 0; pointIndex < numPoints; pointIndex++)
|
||||
{
|
||||
Vector3 pcoords;
|
||||
@ -91,7 +90,6 @@ void TestPCoordsSpecial(const PointWCoordsType& pointWCoords, CellShapeTag shape
|
||||
}
|
||||
|
||||
{
|
||||
std::cout << " Test parametric coordinates at cell center." << std::endl;
|
||||
Vector3 wcoords = pointWCoords[0];
|
||||
for (vtkm::IdComponent pointIndex = 1; pointIndex < numPoints; pointIndex++)
|
||||
{
|
||||
@ -130,8 +128,6 @@ void TestPCoordsSample(const PointWCoordsType& pointWCoords, CellShapeTag shape)
|
||||
}
|
||||
pcoords = (1 / totalWeight) * pcoords;
|
||||
|
||||
std::cout << " Test parametric coordinates at " << pcoords << std::endl;
|
||||
|
||||
// If you convert to world coordinates and back, you should get the
|
||||
// same value.
|
||||
Vector3 wcoords;
|
||||
@ -211,7 +207,6 @@ struct TestPCoordsFunctor
|
||||
void TestAllPCoords()
|
||||
{
|
||||
vtkm::UInt32 seed = static_cast<vtkm::UInt32>(std::time(nullptr));
|
||||
std::cout << "Seed: " << seed << std::endl;
|
||||
g_RandomGenerator.seed(seed);
|
||||
|
||||
std::cout << "======== Float32 ==========================" << std::endl;
|
||||
|
Loading…
Reference in New Issue
Block a user