Skip to content
Snippets Groups Projects
Commit 57a4f626 authored by William F Godoy's avatar William F Godoy
Browse files

Move VTI data to VTK external data

Added bp3 test files
Fix config issues
Resolve build warning on taanab
parent 5da73cb2
No related branches found
No related tags found
No related merge requests found
Showing
with 45 additions and 223 deletions
......@@ -27,7 +27,6 @@ if (vtk_io_adios2_core_enabled)
list(APPEND private_templates ${private_templates_core})
endif()
# ADIOS2 VTX Reader (currently broken on win32 and apple)
set(classes_vtx vtkADIOS2VTXReader)
set(private_classes_vtx
VTX/VTXSchemaManager
......@@ -43,13 +42,12 @@ set(private_templates_vtx
VTX/schema/VTXSchema.txx
VTX/schema/vtk/VTXvtkVTI.txx
VTX/schema/vtk/VTXvtkVTU.txx)
# VTX reader is currently broken on a few platforms.
#if (VTK_USE_MPI)
# set(vtk_io_adios2_vtx_enabled TRUE CACHE INTERNAL "" FORCE)
#else ()
# set(vtk_io_adios2_vtx_enabled FALSE CACHE INTERNAL "" FORCE)
#endif()
set(vtk_io_adios2_vtx_enabled FALSE CACHE INTERNAL "" FORCE)
if (VTK_USE_MPI)
set(vtk_io_adios2_vtx_enabled TRUE CACHE INTERNAL "" FORCE)
else ()
set(vtk_io_adios2_vtx_enabled FALSE CACHE INTERNAL "" FORCE)
endif()
if (vtk_io_adios2_vtx_enabled)
list(APPEND classes ${classes_vtx})
......
......@@ -7,5 +7,11 @@ vtk_module_test_data(
Data/ADIOS2/HeatMap3D_3-step/HeatMap3D3TimeSteps.bp.dir/,REGEX:.*
Data/ADIOS2/2D_HeatTransfer_10-step/,REGEX:.*
Data/ADIOS2/2D_HeatTransfer_10-step/sim.bp.dir/,REGEX:.*
Data/ADIOS2/vtx/bp3/,REGEX:.*
Data/ADIOS2/vtx/bp3/heat3D_1.bp.dir/,REGEX:.*
Data/ADIOS2/vtx/bp3/heat3D_2.bp.dir/,REGEX:.*
Data/ADIOS2/vtx/bp3/heat3D_3.bp.dir/,REGEX:.*
Data/ADIOS2/vtx/bp3/heat3D_4.bp.dir/,REGEX:.*
Data/ADIOS2/vtx/bp3/heat1D_1.bp.dir/,REGEX:.*
)
add_subdirectory(Cxx)
......@@ -15,12 +15,12 @@ if (ADIOS2_HAVE_MPI)
# VTX tests
if (vtk_io_adios2_vtx_enabled)
vtk_add_test_cxx(vtkIOADIOS2VTXCxxTests tests NO_DATA NO_VALID NO_OUTPUT
UnitTestIOADIOS2VTX.cxx
TestIOADIOS2VTX_VTI3D.cxx
TestIOADIOS2VTX_VTI3DRendering.cxx
TestIOADIOS2VTX_VTU3D.cxx
TestIOADIOS2VTX_VTU3DRendering.cxx)
vtk_add_test_cxx(vtkIOADIOS2VTXCxxTests tests TESTING_DATA NO_OUTPUT
UnitTestIOADIOS2VTX.cxx, NO_VALID
TestIOADIOS2VTX_VTI3D.cxx,
TestIOADIOS2VTX_VTI3DRendering.cxx, NO_VALID
TestIOADIOS2VTX_VTU3D.cxx, NO_VALID
TestIOADIOS2VTX_VTU3DRendering.cxx, NO_VALID)
vtk_test_cxx_executable(vtkIOADIOS2VTXCxxTests tests)
target_link_libraries(vtkIOADIOS2VTXCxxTests PUBLIC adios2::adios2)
......
......@@ -51,6 +51,7 @@
#include "vtkNew.h"
#include "vtkObjectFactory.h"
#include "vtkStreamingDemandDrivenPipeline.h"
#include "vtkTestUtilities.h"
#include <adios2.h>
#include <vtksys/SystemTools.hxx>
......@@ -88,11 +89,6 @@ int MPIGetSize()
return size;
}
std::size_t TotalElements(const std::vector<std::size_t>& dimensions) noexcept
{
return std::accumulate(dimensions.begin(), dimensions.end(), 1, std::multiplies<std::size_t>());
}
template<class T>
void ExpectEqual(const T& one, const T& two, const std::string& message)
{
......@@ -227,188 +223,6 @@ private:
vtkStandardNewMacro(TesterVTI3D);
namespace
{
void WriteBPFile3DVars(const std::string& fileName, const adios2::Dims& shape,
const adios2::Dims& start, const adios2::Dims& count, const size_t steps, const int rank,
const bool isAttribute, const bool hasTime, const bool isCellData = true)
{
const size_t totalElements = TotalElements(count);
const size_t Nx = isCellData ? shape[0] : shape[0] - 1;
const size_t Ny = isCellData ? shape[1] : shape[1] - 1;
const size_t Nz = isCellData ? shape[2] : shape[2] - 1;
const std::string extent =
"0 " + std::to_string(Nx) + " " + "0 " + std::to_string(Ny) + " " + "0 " + std::to_string(Nz);
const std::string dataSetType = isCellData ? "CellData" : "PointData";
// clang-format off
const std::string timeStr = hasTime ? R"(
<DataArray Name="TIME"> time </DataArray> )"
: "";
// clang-format on
const std::string imageSchema = R"(<?xml version="1.0"?>
<VTKFile type="ImageData" version="0.1" byte_order="LittleEndian">
<ImageData WholeExtent=")" + extent +
R"(" Origin="0 0 0" Spacing="1 1 1">
<Piece Extent=")" + extent +
R"(">
<)" + dataSetType + R"(>
<DataArray Name="Tdouble" />
<DataArray Name="Tfloat" />
<DataArray Name="Tint64" />
<DataArray Name="Tuint64" />
<DataArray Name="Tint32" />
<DataArray Name="Tuint32" />
)" + timeStr + R"(
</)" + dataSetType + R"(>
</Piece>
</ImageData>
</VTKFile>)";
// using adios2 C++ high-level API
std::vector<double> Tdouble(totalElements);
std::vector<float> Tfloat(totalElements);
std::vector<int64_t> Tint64(totalElements);
std::vector<uint64_t> Tuint64(totalElements);
std::vector<int32_t> Tint32(totalElements);
std::vector<uint32_t> Tuint32(totalElements);
adios2::fstream fw(fileName, adios2::fstream::out, MPIGetComm());
if (isAttribute)
{
fw.write_attribute("vtk.xml", imageSchema);
}
for (size_t t = 0; t < steps; ++t)
{
TStep(Tdouble, t, rank);
TStep(Tfloat, t, rank);
TStep(Tint64, t, rank);
TStep(Tuint64, t, rank);
TStep(Tint32, t, rank);
TStep(Tuint32, t, rank);
if (hasTime)
{
fw.write("time", t);
}
fw.write("Tdouble", Tdouble.data(), shape, start, count);
fw.write("Tfloat", Tfloat.data(), shape, start, count);
fw.write("Tint64", Tint64.data(), shape, start, count);
fw.write("Tuint64", Tuint64.data(), shape, start, count);
fw.write("Tint32", Tint32.data(), shape, start, count);
fw.write("Tuint32", Tuint32.data(), shape, start, count);
fw.end_step();
}
fw.close();
if (!isAttribute)
{
std::ofstream fxml(fileName + ".dir/vtk.xml", ofstream::out);
fxml << imageSchema << "\n";
fxml.close();
}
}
void WriteBPFile1DVars(const std::string& fileName, const adios2::Dims& shape,
const adios2::Dims& start, const adios2::Dims& count, const size_t steps, const int rank,
const bool isAttribute, const bool hasTime, const bool isCellData = true)
{
const size_t totalElements = TotalElements(count);
const size_t Nx = isCellData ? shape[0] : shape[0] - 1;
const size_t Ny = isCellData ? shape[1] : shape[1] - 1;
const size_t Nz = isCellData ? shape[2] : shape[2] - 1;
const std::string extent =
"0 " + std::to_string(Nx) + " " + "0 " + std::to_string(Ny) + " " + "0 " + std::to_string(Nz);
const std::string dataSetType = isCellData ? "CellData" : "PointData";
// clang-format off
const std::string timeStr = hasTime ? R"(
<DataArray Name = "TIME" > time </DataArray> )"
: "";
// clang-format on
const std::string imageSchema = R"(<?xml version="1.0"?>
<VTKFile type="ImageData" version="0.1" byte_order="LittleEndian">
<ImageData WholeExtent=")" + extent +
R"(" Origin="0 0 0" Spacing="1 1 1">
<Piece Extent=")" + extent +
R"(">
<)" + dataSetType + R"(>
<DataArray Name="Tdouble" />
<DataArray Name="Tfloat" />
<DataArray Name="Tint64" />
<DataArray Name="Tuint64" />
<DataArray Name="Tint32" />
<DataArray Name="Tuint32" />
)" + timeStr + R"(
</)" + dataSetType + R"(>
</Piece>
</ImageData>
</VTKFile>)";
// using adios2 C++ high-level API
std::vector<double> Tdouble(totalElements);
std::vector<float> Tfloat(totalElements);
std::vector<int64_t> Tint64(totalElements);
std::vector<uint64_t> Tuint64(totalElements);
std::vector<int32_t> Tint32(totalElements);
std::vector<uint32_t> Tuint32(totalElements);
const adios2::Dims shape1D = { TotalElements(shape) };
const size_t linearStart = start[0] * shape[1] * shape[2] + start[1] * shape[2] + start[2];
const adios2::Dims start1D = { linearStart };
const adios2::Dims count1D = { TotalElements(count) };
adios2::fstream fw(fileName, adios2::fstream::out, MPIGetComm());
if (isAttribute)
{
fw.write_attribute("vtk.xml", imageSchema);
}
for (size_t t = 0; t < steps; ++t)
{
TStep(Tdouble, t, rank);
TStep(Tfloat, t, rank);
TStep(Tint64, t, rank);
TStep(Tuint64, t, rank);
TStep(Tint32, t, rank);
TStep(Tuint32, t, rank);
if (hasTime)
{
fw.write("time", t);
}
fw.write("Tdouble", Tdouble.data(), shape1D, start1D, count1D);
fw.write("Tfloat", Tfloat.data(), shape1D, start1D, count1D);
fw.write("Tint64", Tint64.data(), shape1D, start1D, count1D);
fw.write("Tuint64", Tuint64.data(), shape1D, start1D, count1D);
fw.write("Tint32", Tint32.data(), shape1D, start1D, count1D);
fw.write("Tuint32", Tuint32.data(), shape1D, start1D, count1D);
fw.end_step();
}
fw.close();
if (!isAttribute)
{
std::ofstream fxml(fileName + ".dir/vtk.xml", ofstream::out);
fxml << imageSchema << "\n";
fxml.close();
}
}
} // end empty namespace
int TestIOADIOS2VTX_VTI3D(int argc, char* argv[])
{
auto lf_DoTest = [&](const std::string& fileName, const size_t steps) {
......@@ -439,41 +253,31 @@ int TestIOADIOS2VTX_VTI3D(int argc, char* argv[])
const size_t steps = 3;
// this are cell data dimensions
const adios2::Dims count{ 10, 10, 8 };
const adios2::Dims count{ 10, 10, 4 };
const adios2::Dims start{ static_cast<size_t>(rank) * count[0], 0, 0 };
const adios2::Dims shape{ static_cast<size_t>(size) * count[0], count[1], count[2] };
const std::string fileName = "heat3D.bp";
char* filePath;
// schema as file in bp dir without time
WriteBPFile3DVars(fileName, shape, start, count, steps, rank, false, false);
lf_DoTest(fileName, steps);
vtksys::SystemTools::RemoveADirectory("heat3D.bp.dir");
vtksys::SystemTools::RemoveFile("heat3D.bp");
filePath = vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/ADIOS2/vtx/bp3/heat3D_1.bp");
lf_DoTest(filePath, steps);
// schema as attribute in bp file
WriteBPFile3DVars(fileName, shape, start, count, steps, rank, true, true);
lf_DoTest(fileName, steps);
vtksys::SystemTools::RemoveADirectory("heat3D.bp.dir");
vtksys::SystemTools::RemoveFile("heat3D.bp");
filePath = vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/ADIOS2/vtx/bp3/heat3D_2.bp");
lf_DoTest(filePath, steps);
// schema as file in bp dir
WriteBPFile3DVars(fileName, shape, start, count, steps, rank, false, true);
lf_DoTest(fileName, steps);
vtksys::SystemTools::RemoveADirectory("heat3D.bp.dir");
vtksys::SystemTools::RemoveFile("heat3D.bp");
filePath = vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/ADIOS2/vtx/bp3/heat3D_3.bp");
lf_DoTest(filePath, steps);
// schema for point data
WriteBPFile3DVars(fileName, shape, start, count, steps, rank, false, true, false);
lf_DoTest(fileName, steps);
vtksys::SystemTools::RemoveADirectory("heat3D.bp.dir");
vtksys::SystemTools::RemoveFile("heat3D.bp");
filePath = vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/ADIOS2/vtx/bp3/heat3D_4.bp");
lf_DoTest(filePath, steps);
// cell data from 1D arrays
WriteBPFile1DVars(fileName, shape, start, count, steps, rank, false, true);
lf_DoTest(fileName, steps);
vtksys::SystemTools::RemoveADirectory("heat3D.bp.dir");
vtksys::SystemTools::RemoveFile("heat3D.bp");
filePath = vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/ADIOS2/vtx/bp3/heat1D_1.bp");
lf_DoTest(filePath, steps);
mpiController->Finalize();
return 0;
......
3b7691cc644c5e3691e51345caf90e59ce22a48b25b1bb7b2d4ed4f40c786388cea90dcb6514d9abe7d87df98bd9fe57f8d9f760dda1711991cb0a0078f0b0c4
ebacfdce34bd8ba7585631be7bc427d8e3e0f5f66223f40ec72dd4ee0619257b972c4708f723f2774af81eb40bbe67f17fb6712a805436b53f347d390fce4fae
44fc45a401f13916696ca1c1b414d3f08ba5c23a7aadfbc2e1f53a59c195101b4daaae334e9be80f4f7dddb5b845e9c7e3b2a00e9a092bb0fa6bd3acae3c8d5b
a1c262c92716c00812e4e62b08b59251f715db5f8c779aafee481fe072d149ef81fb5fd19c47230789744c16b08d878b98eb303a4d9e35b34006b50f56421a28
39062ea26b733f411e54c38b08efc15d761e487cb34cd66b01e2f170a7daff3047bf301e2f34b6101744d35ba9544caf6606fd8b1fc387c171cd156613e5e44a
ece63429cd16e7c23c446aae69216c4279deddcbc6a1128d3e67d2ecc3d98a7412747033d45306d698d38ab09df63199bc879562f08859eb942a59bf92de6425
6ad0a4a55d27527c84d61079457caec5c804a6d919d6a83c8918b084883ec8571b010f5c8846f9e8fdf758f73d227863b7900b31954241f87d2d72db68735e6a
884559865e2d5f1b70fd833521821fdd0627a0eaaef78c261f64cbbf2d4288fbf1f8b48180d8bb63fbe40c08f9949cccdd38e203baeda55398f9dfd7f5d8de52
f0bc58455a7cc912458f3a9d107d59e959c5378c4b6aeac06343e30d8eb5d28981227fc70c12b8d6beae78b355b4b18e0b6e91edf96d530c8683bea740e1271e
408b6310e1238006759dfc2def23fb617382b193d8784ecd99df1bc586702057ff04e8ca4f1218cf8b0ac8a283105243c2c209312f12aaf5a3f9ab38bfadef66
9a9d95428af1016b130c4e7747616fa279cad8f1a1b12abb6d2c6860e911b9a02e0b3366641cf491ca91e5c2fb73f02d9042abf2298ac753b6180ad252992de1
b7973b4bbb7a26668df3894c889e671a51e73ace35a3f90d4655a6adb1b11106ba753e1dea49c8fcf268de0e229ed4a4ea9691b7864d02f1945e5b41fe69629a
e9e547522c4eb18c73dd1dd7e9b531b244c32d1dfeb3883a6db67da1cfb9016ea39e6fa96283162ee6357b16ec2ddc739d0b6e8dc7a57bce6085c667618813a9
0514a6b55f7fb2274706e6ef67cff5561386db5c616d7068e4d62a0e828fbaadc63352ef4df5b2cf785c3b7525f208bb76e0066c106d9df53a4c788f4d19a37c
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment