Merge topic 'remove-unlicensed-data'

5aba6e1be Remove unlicensed data

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Vicente Bolea <vicente.bolea@kitware.com>
Merge-request: !3012
This commit is contained in:
Kenneth Moreland 2023-03-14 15:41:41 +00:00 committed by Kitware Robot
commit 7ddf3d85c5
12 changed files with 187 additions and 319 deletions

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

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

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

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

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

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

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

@ -16,11 +16,11 @@
#include <vtkm/io/VTKDataSetWriter.h>
// Example computing streamlines.
// An example vector field is available in the vtk-m data directory: magField.vtk
// An example vector field is available in the vtk-m data directory: rotate-vectors.vtk
// Example usage:
// this will advect 200 particles 50 steps using a step size of 0.01
// this will advect 200 particles 50 steps using a step size of 0.05
//
// Particle_Advection <path-to-data-dir>/magField.vtk vec 200 50 0.01 output.vtk
// Particle_Advection <path-to-data-dir>/rotate-vectors.vtk rotate 200 50 0.05 output.vtk
//
int main(int argc, char** argv)
@ -28,10 +28,10 @@ int main(int argc, char** argv)
auto opts = vtkm::cont::InitializeOptions::DefaultAnyDevice;
auto config = vtkm::cont::Initialize(argc, argv, opts);
if (argc < 8)
if (argc < 7)
{
std::cerr << "Usage: " << argv[0]
<< "dataFile varName numSeeds numSteps stepSize outputFile [options]" << std::endl;
<< " dataFile varName numSeeds numSteps stepSize outputFile [options]" << std::endl;
std::cerr << "where options are: " << std::endl << config.Usage << std::endl;
return -1;
}

@ -75,11 +75,11 @@ void LoadData(std::string& fname, std::vector<vtkm::cont::DataSet>& dataSets, in
}
// Example computing streamlines.
// An example vector field is available in the vtk-m data directory: magField.vtk
// An example vector field is available in the vtk-m data directory: rotate-vectors.vtk
// Example usage:
// this will advect 200 particles 50 steps using a step size of 0.01
// this will advect 200 particles 50 steps using a step size of 0.05
//
// Particle_Advection <path-to-data-dir>/magField.vtk vec 200 50 0.01 output.vtk
// Particle_Advection <path-to-data-dir>/rotate-vectors.vtk vec 200 50 0.05 output.vtk
//
int main(int argc, char** argv)

@ -513,24 +513,25 @@ void ValidateEndPoints(const CellSetType& cellSet,
}
}
void TestStreamlineFile(const std::string& fname,
void TestStreamlineFile(const std::string& fileName,
const std::string& fieldName,
const std::vector<vtkm::Vec3f>& pts,
vtkm::FloatDefault stepSize,
vtkm::Id maxSteps,
const std::vector<vtkm::Vec3f>& endPts,
bool useSL)
{
vtkm::io::VTKDataSetReader reader(fname);
vtkm::io::VTKDataSetReader reader(fileName);
vtkm::cont::DataSet ds;
try
{
ds = reader.ReadDataSet();
VTKM_TEST_ASSERT(ds.HasField("vec"));
VTKM_TEST_ASSERT(ds.HasField(fieldName));
}
catch (vtkm::io::ErrorIO& e)
{
std::string message("Error reading: ");
message += fname;
message += fileName;
message += ", ";
message += e.GetMessage();
@ -550,7 +551,7 @@ void TestStreamlineFile(const std::string& fname,
streamline.SetStepSize(stepSize);
streamline.SetNumberOfSteps(maxSteps);
streamline.SetSeeds(seedArray);
streamline.SetActiveField("vec");
streamline.SetActiveField(fieldName);
output = streamline.Execute(ds);
}
else
@ -559,7 +560,7 @@ void TestStreamlineFile(const std::string& fname,
particleAdvection.SetStepSize(stepSize);
particleAdvection.SetNumberOfSteps(maxSteps);
particleAdvection.SetSeeds(seedArray);
particleAdvection.SetActiveField("vec");
particleAdvection.SetActiveField(fieldName);
output = particleAdvection.Execute(ds);
}
@ -604,48 +605,59 @@ void TestStreamlineFilters()
for (auto useSL : flags)
TestAMRStreamline(useSL);
//Fusion test.
std::vector<vtkm::Vec3f> fusionPts, fusionEndPts;
fusionPts.push_back(vtkm::Vec3f(0.8f, 0.6f, 0.6f));
fusionPts.push_back(vtkm::Vec3f(0.8f, 0.8f, 0.6f));
fusionPts.push_back(vtkm::Vec3f(0.8f, 0.8f, 0.3f));
//End point values were generated in VisIt.
fusionEndPts.push_back(vtkm::Vec3f(0.5335789918f, 0.87112802267f, 0.6723330020f));
fusionEndPts.push_back(vtkm::Vec3f(0.5601879954f, 0.91389900446f, 0.43989110522f));
fusionEndPts.push_back(vtkm::Vec3f(0.7004770041f, 0.63193398714f, 0.64524400234f));
vtkm::FloatDefault fusionStep = 0.005f;
std::string fusionFile = vtkm::cont::testing::Testing::DataPath("rectilinear/fusion.vtk");
{
//Rotate test.
std::vector<vtkm::Vec3f> startPoints, endPoints;
startPoints.push_back(vtkm::Vec3f(0.4f, 0.3f, -0.2f));
startPoints.push_back(vtkm::Vec3f(-0.4f, 0.0f, -0.84f));
startPoints.push_back(vtkm::Vec3f(0.0f, 0.0f, 0.41f));
//End point values were generated in VisIt.
endPoints.push_back(vtkm::Vec3f(-0.341196f, 0.474331f, 0.142614f));
endPoints.push_back(vtkm::Vec3f(-0.342764f, -0.713572f, -0.746209f));
endPoints.push_back(vtkm::Vec3f(-0.617492f, -0.0167f, 0.104733f));
vtkm::FloatDefault stepSize = 0.1f;
std::string file = vtkm::cont::testing::Testing::DataPath("uniform/rotate-vectors.vtk");
for (auto useSL : flags)
TestStreamlineFile(fusionFile, fusionPts, fusionStep, 1000, fusionEndPts, useSL);
for (auto useSL : flags)
{
TestStreamlineFile(file, "rotate", startPoints, stepSize, 1000, endPoints, useSL);
}
}
//Fishtank test.
std::vector<vtkm::Vec3f> fishPts, fishEndPts;
fishPts.push_back(vtkm::Vec3f(0.75f, 0.5f, 0.01f));
fishPts.push_back(vtkm::Vec3f(0.4f, 0.2f, 0.7f));
fishPts.push_back(vtkm::Vec3f(0.5f, 0.3f, 0.8f));
//End point values were generated in VisIt.
fishEndPts.push_back(vtkm::Vec3f(0.7734669447f, 0.4870159328f, 0.8979591727f));
fishEndPts.push_back(vtkm::Vec3f(0.7257543206f, 0.1277695596f, 0.7468645573f));
fishEndPts.push_back(vtkm::Vec3f(0.8347796798f, 0.1276152730f, 0.4985143244f));
vtkm::FloatDefault fishStep = 0.001f;
std::string fishFile = vtkm::cont::testing::Testing::DataPath("rectilinear/fishtank.vtk");
{
//Kitchen test.
std::vector<vtkm::Vec3f> startPoints, endPoints;
startPoints.push_back(vtkm::Vec3f(6.0f, 1.0f, 2.0f));
startPoints.push_back(vtkm::Vec3f(1.3f, 2.4f, 1.3f));
startPoints.push_back(vtkm::Vec3f(1.0f, 3.0f, 2.0f));
//End point values were generated in VisIt.
endPoints.push_back(vtkm::Vec3f(4.42419f, 0.956935f, 1.89111f));
endPoints.push_back(vtkm::Vec3f(0.217019f, 3.65243f, 2.49638f));
endPoints.push_back(vtkm::Vec3f(0.753178f, 0.410568f, 1.11006f));
vtkm::FloatDefault stepSize = 0.2f;
std::string file = vtkm::cont::testing::Testing::DataPath("curvilinear/kitchen.vtk");
for (auto useSL : flags)
TestStreamlineFile(fishFile, fishPts, fishStep, 100, fishEndPts, useSL);
for (auto useSL : flags)
{
TestStreamlineFile(file, "velocity", startPoints, stepSize, 2000, endPoints, useSL);
}
}
//ARMWind corner case of particle near boundary.
std::string amrWindFile =
vtkm::cont::testing::Testing::DataPath("rectilinear/amr_wind_flowfield.vtk");
vtkm::FloatDefault amrWindStep = 0.001f;
std::vector<vtkm::Vec3f> amrWindPts, amrWindEndPts;
{
//ARMWind corner case of particle near boundary.
std::string file = vtkm::cont::testing::Testing::DataPath("rectilinear/amr_wind_flowfield.vtk");
vtkm::FloatDefault stepSize = 0.001f;
std::vector<vtkm::Vec3f> startPoints, endPoints;
amrWindPts.push_back(
vtkm::Vec3f(0.053217993470017745f, 0.034506499099396459f, 0.057097713925011492f));
amrWindEndPts.push_back(vtkm::Vec3f(0.05712112784f, 0.03450008854f, 0.02076501213f));
startPoints.push_back(
vtkm::Vec3f(0.053217993470017745f, 0.034506499099396459f, 0.057097713925011492f));
endPoints.push_back(vtkm::Vec3f(0.05712112784f, 0.03450008854f, 0.02076501213f));
for (auto useSL : flags)
TestStreamlineFile(amrWindFile, amrWindPts, amrWindStep, 10000, amrWindEndPts, useSL);
for (auto useSL : flags)
{
TestStreamlineFile(file, "vec", startPoints, stepSize, 10000, endPoints, useSL);
}
}
}
}

@ -839,15 +839,16 @@ void ValidateResult(const ResultType& res,
}
void TestParticleAdvectionFile(const std::string& fname,
void TestParticleAdvectionFile(const std::string& fileName,
const std::string& fieldName,
const std::vector<vtkm::Vec3f>& pts,
vtkm::FloatDefault stepSize,
vtkm::Id maxSteps,
const std::vector<vtkm::Vec3f>& endPts)
{
VTKM_LOG_S(vtkm::cont::LogLevel::Info, "Testing particle advection on file " << fname);
vtkm::io::VTKDataSetReader reader(fname);
VTKM_LOG_S(vtkm::cont::LogLevel::Info, "Testing particle advection on file " << fileName);
vtkm::io::VTKDataSetReader reader(fileName);
vtkm::cont::DataSet ds;
try
{
@ -856,7 +857,7 @@ void TestParticleAdvectionFile(const std::string& fname,
catch (vtkm::io::ErrorIO& e)
{
std::string message("Error reading: ");
message += fname;
message += fileName;
message += ", ";
message += e.GetMessage();
@ -869,8 +870,8 @@ void TestParticleAdvectionFile(const std::string& fname,
using RK4Type = vtkm::worklet::flow::RK4Integrator<GridEvalType>;
using Stepper = vtkm::worklet::flow::Stepper<RK4Type, GridEvalType>;
VTKM_TEST_ASSERT(ds.HasField("vec"), "Data set missing a field named 'vec'");
vtkm::cont::Field& field = ds.GetField("vec");
VTKM_TEST_ASSERT(ds.HasField(fieldName), "Data set missing a field named ", fieldName);
vtkm::cont::Field& field = ds.GetField(fieldName);
auto fieldData = field.GetData();
FieldHandle fieldArray;
@ -923,32 +924,35 @@ void TestParticleAdvection()
TestWorkletsBasic();
TestParticleWorkletsWithDataSetTypes();
//Fusion test.
std::vector<vtkm::Vec3f> fusionPts, fusionEndPts;
fusionPts.push_back(vtkm::Vec3f(0.8f, 0.6f, 0.6f));
fusionPts.push_back(vtkm::Vec3f(0.8f, 0.8f, 0.6f));
fusionPts.push_back(vtkm::Vec3f(0.8f, 0.8f, 0.3f));
//End point values were generated in VisIt.
fusionEndPts.push_back(vtkm::Vec3f(0.5335789918f, 0.87112802267f, 0.6723330020f));
fusionEndPts.push_back(vtkm::Vec3f(0.5601879954f, 0.91389900446f, 0.43989110522f));
fusionEndPts.push_back(vtkm::Vec3f(0.7004770041f, 0.63193398714f, 0.64524400234f));
vtkm::FloatDefault fusionStep = 0.005f;
std::string fusionFile = vtkm::cont::testing::Testing::DataPath("rectilinear/fusion.vtk");
TestParticleAdvectionFile(fusionFile, fusionPts, fusionStep, 1000, fusionEndPts);
{
//Rotate test.
std::vector<vtkm::Vec3f> startPoints, endPoints;
startPoints.push_back(vtkm::Vec3f(0.4f, 0.3f, -0.2f));
startPoints.push_back(vtkm::Vec3f(-0.4f, 0.0f, -0.84f));
startPoints.push_back(vtkm::Vec3f(0.0f, 0.0f, 0.41f));
//End point values were generated in VisIt.
endPoints.push_back(vtkm::Vec3f(-0.341196f, 0.474331f, 0.142614f));
endPoints.push_back(vtkm::Vec3f(-0.342764f, -0.713572f, -0.746209f));
endPoints.push_back(vtkm::Vec3f(-0.617492f, -0.0167f, 0.104733f));
vtkm::FloatDefault stepSize = 0.1f;
std::string file = vtkm::cont::testing::Testing::DataPath("uniform/rotate-vectors.vtk");
TestParticleAdvectionFile(file, "rotate", startPoints, stepSize, 1000, endPoints);
}
//Fishtank test.
std::vector<vtkm::Vec3f> fishPts, fishEndPts;
fishPts.push_back(vtkm::Vec3f(0.75f, 0.5f, 0.01f));
fishPts.push_back(vtkm::Vec3f(0.4f, 0.2f, 0.7f));
fishPts.push_back(vtkm::Vec3f(0.5f, 0.3f, 0.8f));
//End point values were generated in VisIt.
fishEndPts.push_back(vtkm::Vec3f(0.7734669447f, 0.4870159328f, 0.8979591727f));
fishEndPts.push_back(vtkm::Vec3f(0.7257543206f, 0.1277695596f, 0.7468645573f));
fishEndPts.push_back(vtkm::Vec3f(0.8347796798f, 0.1276152730f, 0.4985143244f));
vtkm::FloatDefault fishStep = 0.001f;
std::string fishFile = vtkm::cont::testing::Testing::DataPath("rectilinear/fishtank.vtk");
TestParticleAdvectionFile(fishFile, fishPts, fishStep, 100, fishEndPts);
{
//Kitchen test.
std::vector<vtkm::Vec3f> startPoints, endPoints;
startPoints.push_back(vtkm::Vec3f(6.0f, 1.0f, 2.0f));
startPoints.push_back(vtkm::Vec3f(1.3f, 2.4f, 1.3f));
startPoints.push_back(vtkm::Vec3f(1.0f, 3.0f, 2.0f));
//End point values were generated in VisIt.
endPoints.push_back(vtkm::Vec3f(4.42419f, 0.956935f, 1.89111f));
endPoints.push_back(vtkm::Vec3f(0.217019f, 3.65243f, 2.49638f));
endPoints.push_back(vtkm::Vec3f(0.753178f, 0.410568f, 1.11006f));
vtkm::FloatDefault stepSize = 0.2f;
std::string file = vtkm::cont::testing::Testing::DataPath("curvilinear/kitchen.vtk");
TestParticleAdvectionFile(file, "velocity", startPoints, stepSize, 2000, endPoints);
}
}
int UnitTestWorkletParticleAdvection(int argc, char* argv[])

@ -368,250 +368,115 @@ void TestReadingStructuredGridBin()
"Incorrect cellset type");
}
void TestReadingFishTank()
void TestReadingRotate()
{
std::string fishtank = vtkm::cont::testing::Testing::DataPath("rectilinear/fishtank.vtk");
vtkm::cont::DataSet ds = readVTKDataSet(fishtank.c_str());
// This is information you can glean by running 'strings' on fishtank.vtk:
VTKM_TEST_ASSERT(ds.GetCellSet().IsType<vtkm::cont::CellSetStructured<3>>(),
"Incorrect cellset type");
VTKM_TEST_ASSERT(ds.GetNumberOfPoints() == 50 * 50 * 50, "Incorrect number of points");
VTKM_TEST_ASSERT(ds.GetCellSet().GetNumberOfPoints() == 50 * 50 * 50,
"Incorrect number of points (from cell set)");
VTKM_TEST_ASSERT(ds.GetNumberOfFields() == 3, "Incorrect number of fields");
VTKM_TEST_ASSERT(ds.HasField("vec"), "The vtk file has a field 'vec', but the dataset does not.");
VTKM_TEST_ASSERT(ds.HasField("vec_magnitude"),
"The vtk file has a field 'vec_magnitude', but the dataset does not.");
// I believe the coordinate system is implicitly given by the first element of X_COORDINATES:
VTKM_TEST_ASSERT(ds.GetNumberOfCoordinateSystems() == 1,
"Need one and only one coordinate system.");
// In order to get the data from the coordinate system, I used the following workflow:
// First, I deleted all ascii header lines just past 'X_COORDINATES 50 float'.
// Once this is done, I can get the binary data from
// $ od -tfF --endian=big fishtank_copy.vtk
// The result is:
// 0 0.020408163 ... 0.9591837 0.97959185 1
// So monotone increasing, bound [0,1].
const vtkm::cont::CoordinateSystem& coordinateSystem = ds.GetCoordinateSystem();
vtkm::Vec<vtkm::Range, 3> ranges = coordinateSystem.GetRange();
vtkm::Range xRange = ranges[0];
VTKM_TEST_ASSERT(xRange.Min == 0);
VTKM_TEST_ASSERT(xRange.Max == 1);
// Do the same past 'Y_COORDINATES 50 float'.
// You get exactly the same as the x data.
vtkm::Range yRange = ranges[1];
VTKM_TEST_ASSERT(yRange.Min == 0);
VTKM_TEST_ASSERT(yRange.Max == 1);
// And finally, do it past 'Z_COORDINATES 50 float':
vtkm::Range zRange = ranges[2];
VTKM_TEST_ASSERT(zRange.Min == 0);
VTKM_TEST_ASSERT(zRange.Max == 1);
// Now delete the text up to LOOKUP TABLE default.
// I see:
// 0 0 0 0 3.5267966 . . .
// This is a vector magnitude, so all values must be >= 0.
// A cursory glance shows that 124.95 is a large value, so we can sanity check the data with the bounds
// [0, ~130].
// And if we open the file in Paraview, we can observe the bounds [0, 156.905].
const vtkm::cont::Field& vec_magnitude = ds.GetField("vec_magnitude");
VTKM_TEST_ASSERT(vec_magnitude.GetName() == "vec_magnitude");
VTKM_TEST_ASSERT(vec_magnitude.IsPointField());
vtkm::Range mag_range;
vec_magnitude.GetRange(&mag_range);
VTKM_TEST_ASSERT(mag_range.Min == 0);
VTKM_TEST_ASSERT(mag_range.Max <= 156.906);
// This info was gleaned from the Paraview Information panel:
const vtkm::cont::Field& vec = ds.GetField("vec");
VTKM_TEST_ASSERT(vec.GetName() == "vec");
VTKM_TEST_ASSERT(vec.IsPointField());
// Bounds from Information panel:
// [-65.3147, 86.267], [-88.0325, 78.7217], [-67.0969, 156.867]
const vtkm::cont::ArrayHandle<vtkm::Range>& vecRanges = vec.GetRange();
VTKM_TEST_ASSERT(vecRanges.GetNumberOfValues() == 3);
auto vecRangesReadPortal = vecRanges.ReadPortal();
auto xVecRange = vecRangesReadPortal.Get(0);
VTKM_TEST_ASSERT(xVecRange.Min >= -65.3148 && xVecRange.Min <= -65.3146);
VTKM_TEST_ASSERT(xVecRange.Max >= 86.26 && xVecRange.Min <= 86.268);
auto yVecRange = vecRangesReadPortal.Get(1);
VTKM_TEST_ASSERT(yVecRange.Min >= -88.0326 && yVecRange.Min <= -88.0324);
VTKM_TEST_ASSERT(yVecRange.Max >= 78.721);
VTKM_TEST_ASSERT(yVecRange.Max <= 78.7218);
auto zVecRange = vecRangesReadPortal.Get(2);
VTKM_TEST_ASSERT(zVecRange.Min >= -67.097 && zVecRange.Min <= -67.096);
VTKM_TEST_ASSERT(zVecRange.Max >= 156.866 && zVecRange.Max <= 156.868);
}
void TestReadingDoublePrecisionFishTank()
{
std::string fishtank =
vtkm::cont::testing::Testing::DataPath("rectilinear/fishtank_double_big_endian.vtk");
vtkm::cont::DataSet ds = readVTKDataSet(fishtank.c_str());
// This is information you can glean by running 'strings' on fishtank.vtk:
VTKM_TEST_ASSERT(ds.GetCellSet().IsType<vtkm::cont::CellSetStructured<3>>(),
"Incorrect cellset type");
VTKM_TEST_ASSERT(ds.GetNumberOfPoints() == 50 * 50 * 50, "Incorrect number of points");
VTKM_TEST_ASSERT(ds.GetCellSet().GetNumberOfPoints() == 50 * 50 * 50,
"Incorrect number of points (from cell set)");
VTKM_TEST_ASSERT(ds.HasField("vec"), "The vtk file has a field 'vec', but the dataset does not.");
VTKM_TEST_ASSERT(ds.GetNumberOfCoordinateSystems() == 1,
"fishtank has one and only one coordinate system.");
// See the single precision version for info:
const vtkm::cont::CoordinateSystem& coordinateSystem = ds.GetCoordinateSystem();
vtkm::Vec<vtkm::Range, 3> ranges = coordinateSystem.GetRange();
vtkm::Range xRange = ranges[0];
VTKM_TEST_ASSERT(xRange.Min == 0);
VTKM_TEST_ASSERT(xRange.Max == 1);
vtkm::Range yRange = ranges[1];
VTKM_TEST_ASSERT(yRange.Min == 0);
VTKM_TEST_ASSERT(yRange.Max == 1);
vtkm::Range zRange = ranges[2];
VTKM_TEST_ASSERT(zRange.Min == 0);
VTKM_TEST_ASSERT(zRange.Max == 1);
// This info was gleaned from the Paraview Information panel:
const vtkm::cont::Field& vec = ds.GetField("vec");
VTKM_TEST_ASSERT(vec.GetName() == "vec");
VTKM_TEST_ASSERT(vec.IsPointField());
// Bounds from Information panel:
// [-65.3147, 86.267], [-88.0325, 78.7217], [-67.0969, 156.867]
const vtkm::cont::ArrayHandle<vtkm::Range>& vecRanges = vec.GetRange();
VTKM_TEST_ASSERT(vecRanges.GetNumberOfValues() == 3);
auto vecRangesReadPortal = vecRanges.ReadPortal();
auto xVecRange = vecRangesReadPortal.Get(0);
VTKM_TEST_ASSERT(xVecRange.Min >= -65.3148 && xVecRange.Min <= -65.3146);
VTKM_TEST_ASSERT(xVecRange.Max >= 86.26 && xVecRange.Min <= 86.268);
auto yVecRange = vecRangesReadPortal.Get(1);
VTKM_TEST_ASSERT(yVecRange.Min >= -88.0326 && yVecRange.Min <= -88.0324);
VTKM_TEST_ASSERT(yVecRange.Max >= 78.721);
VTKM_TEST_ASSERT(yVecRange.Max <= 78.7218);
auto zVecRange = vecRangesReadPortal.Get(2);
VTKM_TEST_ASSERT(zVecRange.Min >= -67.097 && zVecRange.Min <= -67.096);
VTKM_TEST_ASSERT(zVecRange.Max >= 156.866 && zVecRange.Max <= 156.868);
}
void TestReadingASCIIFishTank()
{
std::string fishtank =
vtkm::cont::testing::Testing::DataPath("rectilinear/fishtank_double_ascii.vtk");
vtkm::cont::DataSet ds = readVTKDataSet(fishtank.c_str());
VTKM_TEST_ASSERT(ds.GetCellSet().IsType<vtkm::cont::CellSetStructured<3>>(),
"Incorrect cellset type");
VTKM_TEST_ASSERT(ds.GetNumberOfPoints() == 50 * 50 * 50, "Incorrect number of points");
VTKM_TEST_ASSERT(ds.GetCellSet().GetNumberOfPoints() == 50 * 50 * 50,
"Incorrect number of points (from cell set)");
VTKM_TEST_ASSERT(ds.HasField("vec"), "The vtk file has a field 'vec', but the dataset does not.");
VTKM_TEST_ASSERT(ds.GetNumberOfCoordinateSystems() == 1,
"fishtank has one and only one coordinate system.");
const vtkm::cont::CoordinateSystem& coordinateSystem = ds.GetCoordinateSystem();
vtkm::Vec<vtkm::Range, 3> ranges = coordinateSystem.GetRange();
vtkm::Range xRange = ranges[0];
VTKM_TEST_ASSERT(xRange.Min == 0);
VTKM_TEST_ASSERT(xRange.Max == 1);
vtkm::Range yRange = ranges[1];
VTKM_TEST_ASSERT(yRange.Min == 0);
VTKM_TEST_ASSERT(yRange.Max == 1);
vtkm::Range zRange = ranges[2];
VTKM_TEST_ASSERT(zRange.Min == 0);
VTKM_TEST_ASSERT(zRange.Max == 1);
const vtkm::cont::Field& vec = ds.GetField("vec");
VTKM_TEST_ASSERT(vec.GetName() == "vec");
VTKM_TEST_ASSERT(vec.IsPointField());
// Bounds from Paraview information panel:
// [-65.3147, 86.267], [-88.0325, 78.7217], [-67.0969, 156.867]
const vtkm::cont::ArrayHandle<vtkm::Range>& vecRanges = vec.GetRange();
VTKM_TEST_ASSERT(vecRanges.GetNumberOfValues() == 3);
auto vecRangesReadPortal = vecRanges.ReadPortal();
auto xVecRange = vecRangesReadPortal.Get(0);
VTKM_TEST_ASSERT(xVecRange.Min >= -65.3148 && xVecRange.Min <= -65.3146);
VTKM_TEST_ASSERT(xVecRange.Max >= 86.26 && xVecRange.Min <= 86.268);
auto yVecRange = vecRangesReadPortal.Get(1);
VTKM_TEST_ASSERT(yVecRange.Min >= -88.0326 && yVecRange.Min <= -88.0324);
VTKM_TEST_ASSERT(yVecRange.Max >= 78.721);
VTKM_TEST_ASSERT(yVecRange.Max <= 78.7218);
auto zVecRange = vecRangesReadPortal.Get(2);
VTKM_TEST_ASSERT(zVecRange.Min >= -67.097 && zVecRange.Min <= -67.096);
VTKM_TEST_ASSERT(zVecRange.Max >= 156.866 && zVecRange.Max <= 156.868);
}
void TestReadingFusion()
{
std::string fusion = vtkm::cont::testing::Testing::DataPath("rectilinear/fusion.vtk");
std::string fusion = vtkm::cont::testing::Testing::DataPath("uniform/rotate-vectors.vtk");
vtkm::cont::DataSet ds = readVTKDataSet(fusion.c_str());
VTKM_TEST_ASSERT(ds.GetCellSet().IsType<vtkm::cont::CellSetStructured<3>>(),
"Incorrect cellset type");
VTKM_TEST_ASSERT(ds.GetNumberOfPoints() == 32 * 32 * 32, "Incorrect number of points");
VTKM_TEST_ASSERT(ds.GetCellSet().GetNumberOfPoints() == 32 * 32 * 32,
VTKM_TEST_ASSERT(ds.GetNumberOfPoints() == 33 * 33 * 33, "Incorrect number of points");
VTKM_TEST_ASSERT(ds.GetCellSet().GetNumberOfPoints() == 33 * 33 * 33,
"Incorrect number of points (from cell set)");
VTKM_TEST_ASSERT(ds.HasField("vec_magnitude"),
"The vtk file has a field 'vec_magnitude', but the dataset does not.");
VTKM_TEST_ASSERT(ds.HasField("vec"), "The vtk file has a field 'vec', but the dataset does not.");
VTKM_TEST_ASSERT(ds.GetNumberOfCoordinateSystems() == 1,
"The vtk file has a field 'vec', but the dataset does not.");
VTKM_TEST_ASSERT(ds.HasField("rotate"),
"The vtk file has a field 'rotate', but the dataset does not.");
// Taken from Paraview + clicking Data Axes Grid:
const vtkm::cont::CoordinateSystem& coordinateSystem = ds.GetCoordinateSystem();
vtkm::Vec<vtkm::Range, 3> ranges = coordinateSystem.GetRange();
vtkm::Range xRange = ranges[0];
VTKM_TEST_ASSERT(xRange.Min == 0);
VTKM_TEST_ASSERT(xRange.Min == -1);
VTKM_TEST_ASSERT(xRange.Max == 1);
vtkm::Range yRange = ranges[1];
VTKM_TEST_ASSERT(yRange.Min == 0);
VTKM_TEST_ASSERT(yRange.Min == -1);
VTKM_TEST_ASSERT(yRange.Max == 1);
vtkm::Range zRange = ranges[2];
VTKM_TEST_ASSERT(zRange.Min == 0);
VTKM_TEST_ASSERT(zRange.Min == -1);
VTKM_TEST_ASSERT(zRange.Max == 1);
// Paraview Information Panel of this file:
// vec_magnitude [0, 3.73778]
vtkm::cont::Field vec_magnitude = ds.GetField("vec_magnitude");
VTKM_TEST_ASSERT(vec_magnitude.GetName() == "vec_magnitude");
VTKM_TEST_ASSERT(vec_magnitude.IsPointField());
vtkm::Range mag_range;
vec_magnitude.GetRange(&mag_range);
VTKM_TEST_ASSERT(mag_range.Min == 0);
VTKM_TEST_ASSERT(mag_range.Max <= 3.73779);
VTKM_TEST_ASSERT(mag_range.Max >= 3.73777);
vtkm::cont::Field vec = ds.GetField("vec");
VTKM_TEST_ASSERT(vec.GetName() == "vec");
// rotate double [-1.29845, 1.25443], [-1.34447, 1.22820], [-0.32387, 0.33180]
vtkm::cont::Field vec = ds.GetField("rotate");
VTKM_TEST_ASSERT(vec.GetName() == "rotate");
VTKM_TEST_ASSERT(vec.IsPointField());
const vtkm::cont::ArrayHandle<vtkm::Range>& vecRanges = vec.GetRange();
VTKM_TEST_ASSERT(vecRanges.GetNumberOfValues() == 3);
auto vecRangesReadPortal = vecRanges.ReadPortal();
// vec float [-3.41054, 3.40824], [-3.41018, 3.41036], [-0.689022, 0.480726]
auto xVecRange = vecRangesReadPortal.Get(0);
VTKM_TEST_ASSERT(test_equal(xVecRange.Min, -3.41054));
VTKM_TEST_ASSERT(test_equal(xVecRange.Max, 3.40824));
VTKM_TEST_ASSERT(test_equal(xVecRange.Min, -1.29845));
VTKM_TEST_ASSERT(test_equal(xVecRange.Max, 1.25443));
auto yVecRange = vecRangesReadPortal.Get(1);
VTKM_TEST_ASSERT(test_equal(yVecRange.Min, -3.41018));
VTKM_TEST_ASSERT(test_equal(yVecRange.Max, 3.41036));
VTKM_TEST_ASSERT(test_equal(yVecRange.Min, -1.34447));
VTKM_TEST_ASSERT(test_equal(yVecRange.Max, 1.22820));
auto zVecRange = vecRangesReadPortal.Get(2);
VTKM_TEST_ASSERT(test_equal(zVecRange.Min, -0.689022));
VTKM_TEST_ASSERT(test_equal(zVecRange.Max, 0.480726));
VTKM_TEST_ASSERT(test_equal(zVecRange.Min, -0.32387));
VTKM_TEST_ASSERT(test_equal(zVecRange.Max, 0.33180));
}
void TestReadingKitchen()
{
std::string fusion = vtkm::cont::testing::Testing::DataPath("curvilinear/kitchen.vtk");
vtkm::cont::DataSet ds = readVTKDataSet(fusion.c_str());
VTKM_TEST_ASSERT(ds.GetCellSet().IsType<vtkm::cont::CellSetStructured<3>>(),
"Incorrect cellset type");
VTKM_TEST_ASSERT(ds.GetNumberOfPoints() == 28 * 24 * 17, "Incorrect number of points");
VTKM_TEST_ASSERT(ds.GetCellSet().GetNumberOfPoints() == 28 * 24 * 17,
"Incorrect number of points (from cell set)");
VTKM_TEST_ASSERT(ds.HasField("h1"), "The vtk file has a field 'h1', but the dataset does not.");
VTKM_TEST_ASSERT(ds.HasField("velocity"),
"The vtk file has a field 'velocity', but the dataset does not.");
// Paraview Information Panel of this file:
// Bounds: [0.01, 7], [0.01, 5], [0.01, 2.5]
const vtkm::cont::CoordinateSystem& coordinateSystem = ds.GetCoordinateSystem();
vtkm::Vec<vtkm::Range, 3> ranges = coordinateSystem.GetRange();
vtkm::Range xRange = ranges[0];
VTKM_TEST_ASSERT(test_equal(xRange.Min, 0.01));
VTKM_TEST_ASSERT(test_equal(xRange.Max, 7));
vtkm::Range yRange = ranges[1];
VTKM_TEST_ASSERT(test_equal(yRange.Min, 0.01));
VTKM_TEST_ASSERT(test_equal(yRange.Max, 5));
vtkm::Range zRange = ranges[2];
VTKM_TEST_ASSERT(test_equal(zRange.Min, 0.01));
VTKM_TEST_ASSERT(test_equal(zRange.Max, 2.5));
// h1 float [0, 26823.6]
vtkm::cont::Field h1 = ds.GetField("h1");
VTKM_TEST_ASSERT(h1.GetName() == "h1");
VTKM_TEST_ASSERT(h1.IsPointField());
const vtkm::cont::ArrayHandle<vtkm::Range>& h1Ranges = h1.GetRange();
VTKM_TEST_ASSERT(h1Ranges.GetNumberOfValues() == 1);
auto h1RangesReadPortal = h1Ranges.ReadPortal();
auto h1Range = h1RangesReadPortal.Get(0);
VTKM_TEST_ASSERT(test_equal(h1Range.Min, 0));
VTKM_TEST_ASSERT(test_equal(h1Range.Max, 26823.6));
// velocity float [-0.34942, 0.26521], [-0.31407, 0.31543], [-0.45072, 0.28649]
vtkm::cont::Field vec = ds.GetField("velocity");
VTKM_TEST_ASSERT(vec.GetName() == "velocity");
VTKM_TEST_ASSERT(vec.IsPointField());
const vtkm::cont::ArrayHandle<vtkm::Range>& vecRanges = vec.GetRange();
VTKM_TEST_ASSERT(vecRanges.GetNumberOfValues() == 3);
auto vecRangesReadPortal = vecRanges.ReadPortal();
auto xVecRange = vecRangesReadPortal.Get(0);
VTKM_TEST_ASSERT(test_equal(xVecRange.Min, -0.34942));
VTKM_TEST_ASSERT(test_equal(xVecRange.Max, 0.26521));
auto yVecRange = vecRangesReadPortal.Get(1);
VTKM_TEST_ASSERT(test_equal(yVecRange.Min, -0.31407));
VTKM_TEST_ASSERT(test_equal(yVecRange.Max, 0.31543));
auto zVecRange = vecRangesReadPortal.Get(2);
VTKM_TEST_ASSERT(test_equal(zVecRange.Min, -0.45072));
VTKM_TEST_ASSERT(test_equal(zVecRange.Max, 0.28649));
}
void TestSkppingStringFields(Format format)
@ -668,14 +533,10 @@ void TestReadingVTKDataSet()
TestReadingStructuredGridASCII();
std::cout << "Test reading VTK StructuredGrid file in BINARY" << std::endl;
TestReadingStructuredGridBin();
std::cout << "Test reading float precision fishtank" << std::endl;
TestReadingFishTank();
std::cout << "Test reading double precision fishtank" << std::endl;
TestReadingDoublePrecisionFishTank();
std::cout << "Test ASCII fishtank" << std::endl;
TestReadingASCIIFishTank();
std::cout << "Test reading fusion" << std::endl;
TestReadingFusion();
std::cout << "Test reading rotate" << std::endl;
TestReadingRotate();
std::cout << "Test reading kitchen" << std::endl;
TestReadingKitchen();
std::cout << "Test skipping string fields in ASCII files" << std::endl;
TestSkppingStringFields(FORMAT_ASCII);