diff --git a/IO/Exodus/Testing/Cxx/CMakeLists.txt b/IO/Exodus/Testing/Cxx/CMakeLists.txt index c4c69f97eec4f8941ab93f1423bae02f44894d59..c27a827f4493ab3c421206cedede1f4986f94c8c 100644 --- a/IO/Exodus/Testing/Cxx/CMakeLists.txt +++ b/IO/Exodus/Testing/Cxx/CMakeLists.txt @@ -1,6 +1,6 @@ set(extra_tests) -# We need typed arrays to be supported by the dispatcher to run the insitu test: -if(VTK_DISPATCH_TYPED_ARRAYS) +# We need soa arrays to be supported by the dispatcher to run the insitu test: +if(VTK_DISPATCH_SOA_ARRAYS) list(APPEND extra_tests TestInSituExodus.cxx,NO_VALID ) diff --git a/IO/Exodus/Testing/Cxx/TestInSituExodus.cxx b/IO/Exodus/Testing/Cxx/TestInSituExodus.cxx index 08af299f98466b0546ac1a5e88501f8d4ab846df..3d128a43e4fb07656e71ec350ef21b7b0f8412f0 100644 --- a/IO/Exodus/Testing/Cxx/TestInSituExodus.cxx +++ b/IO/Exodus/Testing/Cxx/TestInSituExodus.cxx @@ -1,11 +1,9 @@ // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen // SPDX-License-Identifier: BSD-3-Clause -#include "vtkCPExodusIIElementBlock.h" #include "vtkCPExodusIIInSituReader.h" -#include "vtkCPExodusIINodalCoordinatesTemplate.h" -#include "vtkCPExodusIIResultsArrayTemplate.h" +#include "vtkAOSDataArrayTemplate.h" #include "vtkCellData.h" #include "vtkCellIterator.h" #include "vtkConeSource.h" @@ -18,7 +16,7 @@ #include "vtkPlane.h" #include "vtkPointData.h" #include "vtkPoints.h" -#include "vtkPolyData.h" +#include "vtkSOADataArrayTemplate.h" #include "vtkSmartPointer.h" #include "vtkTestUtilities.h" #include "vtkTimerLog.h" @@ -388,11 +386,9 @@ void populateAttributes(vtkDataSet* ref, vtkDataSet* test) ref->GetPoint(pointId, point); refScalars->InsertNextTuple1((sin(point[0] * point[1]) + cos(point[2]))); } - vtkNew<vtkCPExodusIIResultsArrayTemplate<double>> testScalars; + vtkNew<vtkAOSDataArrayTemplate<double>> testScalars; testScalars->SetName("test-scalars"); - double* testScalarArray = new double[numPoints]; - memcpy(testScalarArray, refScalars->GetVoidPointer(0), numPoints * sizeof(double)); - testScalars->SetExodusScalarArrays(std::vector<double*>(1, testScalarArray), numPoints); + testScalars->SetArray(refScalars->GetPointer(0), numPoints, /*save=*/true); ref->GetPointData()->SetScalars(refScalars); test->GetPointData()->SetScalars(testScalars); @@ -425,13 +421,15 @@ void populateAttributes(vtkDataSet* ref, vtkDataSet* test) } refNormals->SetTuple(pointId, normal); } - vtkNew<vtkCPExodusIIResultsArrayTemplate<double>> testNormals; + vtkNew<vtkSOADataArrayTemplate<double>> testNormals; testNormals->SetName("test-normals"); - std::vector<double*> testNormalVector; - testNormalVector.push_back(testNormalArrayX); - testNormalVector.push_back(testNormalArrayY); - testNormalVector.push_back(testNormalArrayZ); - testNormals->SetExodusScalarArrays(testNormalVector, numPoints); + testNormals->SetNumberOfComponents(3); + testNormals->SetArray(0, testNormalArrayX, numPoints, /*updateMaxId=*/true, + /*save=*/false, /*deletMethod*/ vtkAbstractArray::VTK_DATA_ARRAY_DELETE); + testNormals->SetArray(1, testNormalArrayY, numPoints, /*updateMaxId=*/false, + /*save=*/false, /*deletMethod*/ vtkAbstractArray::VTK_DATA_ARRAY_DELETE); + testNormals->SetArray(2, testNormalArrayZ, numPoints, /*updateMaxId=*/false, + /*save=*/false, /*deletMethod*/ vtkAbstractArray::VTK_DATA_ARRAY_DELETE); ref->GetPointData()->SetNormals(refNormals); test->GetPointData()->SetNormals(testNormals); @@ -868,7 +866,7 @@ bool testCopies(vtkUnstructuredGridBase* test) void testSaveArrays() { vtkIdType numPoints = 1000; - vtkNew<vtkCPExodusIIResultsArrayTemplate<double>> testScalars; + vtkNew<vtkAOSDataArrayTemplate<double>> testScalars; testScalars->SetName("test-scalars"); double* testScalarArray = new double[numPoints]; for (int i = 0; i < numPoints; i++) @@ -878,9 +876,10 @@ void testSaveArrays() // Call SetExodusScalarArrays a couple of times to make sure // we don't free the same memory multiple times. The final call // is the one that should actually free the array. - testScalars->SetExodusScalarArrays(std::vector<double*>(1, testScalarArray), numPoints, true); - testScalars->SetExodusScalarArrays(std::vector<double*>(1, testScalarArray), numPoints, true); - testScalars->SetExodusScalarArrays(std::vector<double*>(1, testScalarArray), numPoints, false); + testScalars->SetArray(testScalarArray, numPoints, /*save=*/true); + testScalars->SetArray(testScalarArray, numPoints, /*save=*/true); + testScalars->SetArray(testScalarArray, numPoints, /*save=*/false, + /*deletMethod*/ vtkAbstractArray::VTK_DATA_ARRAY_DELETE); } int TestInSituExodus(int argc, char* argv[]) diff --git a/IO/Exodus/vtkCPExodusIIInSituReader.cxx b/IO/Exodus/vtkCPExodusIIInSituReader.cxx index 1940a062124819b08acd8a160928b6aceeef7349..63ec1f90babe510a2d38bb5839ade9547d050e86 100644 --- a/IO/Exodus/vtkCPExodusIIInSituReader.cxx +++ b/IO/Exodus/vtkCPExodusIIInSituReader.cxx @@ -2,10 +2,11 @@ // SPDX-License-Identifier: BSD-3-Clause #include "vtkCPExodusIIInSituReader.h" +#include "vtkCPExodusIINodalCoordinatesTemplate.h" +#include "vtkAOSDataArrayTemplate.h" #include "vtkCPExodusIIElementBlock.h" #include "vtkCPExodusIINodalCoordinatesTemplate.h" -#include "vtkCPExodusIIResultsArrayTemplate.h" #include "vtkCellData.h" #include "vtkDemandDrivenPipeline.h" #include "vtkDoubleArray.h" @@ -310,9 +311,9 @@ bool vtkCPExodusIIInSituReader::ExGetNodalVars() double* nodalVars = new double[this->NumberOfNodes]; int error = ex_get_nodal_var( this->FileId, this->CurrentTimeStep + 1, nodalVarIndex + 1, this->NumberOfNodes, nodalVars); - std::vector<double*> varsVector(1, nodalVars); - vtkNew<vtkCPExodusIIResultsArrayTemplate<double>> nodalVarArray; - nodalVarArray->SetExodusScalarArrays(varsVector, this->NumberOfNodes); + vtkNew<vtkAOSDataArrayTemplate<double>> nodalVarArray; + nodalVarArray->SetArray(nodalVars, this->NumberOfNodes, + /*save=*/false, /*deletMethod*/ vtkAbstractArray::VTK_DATA_ARRAY_DELETE); nodalVarArray->SetName(this->NodalVariableNames[nodalVarIndex].c_str()); if (error < 0) @@ -383,9 +384,9 @@ bool vtkCPExodusIIInSituReader::ExGetElemBlocks() double* elemVars = new double[numElem]; error = ex_get_elem_var(this->FileId, this->CurrentTimeStep + 1, elemVarIndex + 1, this->ElementBlockIds[blockInd], numElem, elemVars); - std::vector<double*> varsVector(1, elemVars); - vtkNew<vtkCPExodusIIResultsArrayTemplate<double>> elemVarArray; - elemVarArray->SetExodusScalarArrays(varsVector, numElem); + vtkNew<vtkAOSDataArrayTemplate<double>> elemVarArray; + elemVarArray->SetArray(elemVars, numElem, + /*save=*/false, /*deletMethod*/ vtkAbstractArray::VTK_DATA_ARRAY_DELETE); elemVarArray->SetName(this->ElementVariableNames[elemVarIndex].c_str()); if (error < 0) diff --git a/IO/Exodus/vtkCPExodusIIResultsArrayTemplate.h b/IO/Exodus/vtkCPExodusIIResultsArrayTemplate.h index 97fd6a8e50da57fedc5e49e194a2aabd303a1263..7aa55f363f78c67d1932e580a1409b95b7c4986b 100644 --- a/IO/Exodus/vtkCPExodusIIResultsArrayTemplate.h +++ b/IO/Exodus/vtkCPExodusIIResultsArrayTemplate.h @@ -15,13 +15,17 @@ #ifndef vtkCPExodusIIResultsArrayTemplate_h #define vtkCPExodusIIResultsArrayTemplate_h +#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_5_0 #include "vtkMappedDataArray.h" #include "vtkObjectFactory.h" // for vtkStandardNewMacro VTK_ABI_NAMESPACE_BEGIN template <class Scalar> -class vtkCPExodusIIResultsArrayTemplate : public vtkMappedDataArray<Scalar> +class VTK_DEPRECATED_IN_9_5_0("Please use the SetArray functionality of `vtkAOSDataArrayTemplate` " + "for 1 component or `vtkSOADataArrayTemplate` for more " + "instead.") vtkCPExodusIIResultsArrayTemplate + : public vtkMappedDataArray<Scalar> { public: vtkAbstractTemplateTypeMacro(