From bd19fc22e9ffc8f0b97a7b5a860dca24ba842599 Mon Sep 17 00:00:00 2001 From: Kitware Robot <kwrobot@kitware.com> Date: Fri, 27 Sep 2024 11:13:55 -0400 Subject: [PATCH] reformat: synchronize formatting with clang-format-16 Also use C++17 syntax rules as the next release expects to use C++17. --- .../Core/Testing/Cxx/TestVTKMDataArray.cxx | 3 +- .../Vtkm/Core/vtkmlib/DataArrayConverters.h | 14 +- .../Testing/Cxx/TestVTKMLevelOfDetail.cxx | 2 +- .../Cxx/TestChartXYZMarginsRotations.cxx | 3 +- .../Testing/Cxx/TestChartXYZUnconstrained.cxx | 3 +- Charts/Core/vtkChartXYZ.cxx | 27 +- Charts/Core/vtkPlotHistogram2D.cxx | 5 +- .../Core/SMP/STDThread/vtkSMPThreadPool.cxx | 56 +- .../Testing/Cxx/TestArrayFreeFunctions.cxx | 10 +- Common/Core/Testing/Cxx/TestAtomic.cxx | 2 +- Common/Core/Testing/Cxx/TestSMP.cxx | 49 +- Common/Core/Testing/Cxx/TestSortDataArray.cxx | 2 +- Common/Core/vtkAbstractArray.h | 5 +- Common/Core/vtkAutoInit.h | 10 +- Common/Core/vtkBatch.h | 109 ++-- Common/Core/vtkByteSwap.cxx | 26 +- Common/Core/vtkCommand.cxx | 9 +- Common/Core/vtkCompositeImplicitBackend.txx | 32 +- Common/Core/vtkInformation.cxx | 30 +- Common/Core/vtkInformationKey.h | 15 +- Common/Core/vtkInherits.h | 6 +- Common/Core/vtkMarshalContext.cxx | 5 +- Common/Core/vtkObjectFactory.h | 20 +- Common/Core/vtkSetGet.h | 144 ++++-- Common/Core/vtkStringToken.cxx | 6 +- Common/Core/vtkThreadedCallbackQueue.cxx | 121 ++--- Common/Core/vtkThreadedCallbackQueue.txx | 5 +- Common/Core/vtkThreadedTaskQueue.txx | 16 +- Common/Core/vtkTypeTraits.h | 35 +- Common/Core/vtkValueFromString.cxx | 3 +- Common/Core/vtkVariant.cxx | 3 +- Common/Core/vtkVariant.h | 3 +- Common/Core/vtkVersion.cxx | 5 +- .../DataModel/Testing/Cxx/TestCellArray.cxx | 42 +- .../Testing/Cxx/TestCellIterators.cxx | 4 +- .../Testing/Cxx/TestCompositeDataSetRange.cxx | 11 +- .../Testing/Cxx/TestDataAssemblyUtilities.cxx | 6 +- .../Testing/Cxx/TestDataObjectTreeRange.cxx | 11 +- .../Testing/Cxx/TestDataSetAttributes.cxx | 9 +- .../Testing/Cxx/TestHigherOrderCell.cxx | 3 +- .../Cxx/TestHyperTreeGridGeometricLocator.cxx | 20 +- .../Testing/Cxx/TestInterpolationDerivs.cxx | 12 +- .../DataModel/Testing/Cxx/TestSMPFeatures.cxx | 26 +- .../Testing/Cxx/TestSelectionExpression.cxx | 76 +-- .../Testing/Cxx/TestSmoothErrorMetric.cxx | 2 +- Common/DataModel/vtkAbstractCellLocator.cxx | 12 +- Common/DataModel/vtkBezierHexahedron.cxx | 24 +- Common/DataModel/vtkBezierInterpolation.cxx | 21 +- Common/DataModel/vtkBezierQuadrilateral.cxx | 14 +- Common/DataModel/vtkBezierTetra.cxx | 24 +- Common/DataModel/vtkBezierTriangle.cxx | 12 +- Common/DataModel/vtkBezierWedge.cxx | 36 +- Common/DataModel/vtkCellArray.h | 7 +- Common/DataModel/vtkCellLinks.cxx | 33 +- Common/DataModel/vtkCellMetadata.h | 5 +- Common/DataModel/vtkDataAssembly.cxx | 9 +- Common/DataModel/vtkDataAssemblyUtilities.cxx | 6 +- Common/DataModel/vtkDataObjectTypes.cxx | 3 +- Common/DataModel/vtkDataSet.cxx | 16 +- .../vtkDataSetAttributesFieldList.cxx | 10 +- .../vtkHyperTreeGridGeometricLocator.cxx | 6 +- Common/DataModel/vtkImplicitFunction.cxx | 22 +- Common/DataModel/vtkLagrangeHexahedron.cxx | 12 +- Common/DataModel/vtkLagrangeQuadrilateral.cxx | 6 +- Common/DataModel/vtkLagrangeTetra.cxx | 12 +- Common/DataModel/vtkLagrangeTriangle.cxx | 6 +- Common/DataModel/vtkLagrangeWedge.cxx | 18 +- Common/DataModel/vtkPolyData.cxx | 54 +- Common/DataModel/vtkPolyLine.cxx | 29 +- Common/DataModel/vtkPolyhedron.cxx | 9 +- Common/DataModel/vtkPolyhedronUtilities.cxx | 3 +- .../DataModel/vtkStaticCellLinksTemplate.txx | 18 +- .../vtkStaticFaceHashLinksTemplate.txx | 33 +- Common/DataModel/vtkStructuredCellArray.cxx | 16 +- Common/DataModel/vtkStructuredData.cxx | 11 +- Common/Math/Testing/Cxx/UnitTestFFT.cxx | 25 +- Common/Math/vtkFFT.cxx | 28 +- Common/Math/vtkFFT.txx | 49 +- Common/Transforms/vtkAbstractTransform.cxx | 76 +-- Common/Transforms/vtkHomogeneousTransform.cxx | 88 ++-- Common/Transforms/vtkIdentityTransform.cxx | 48 +- Common/Transforms/vtkLinearTransform.cxx | 122 +++-- .../vtkThinPlateSplineTransform.cxx | 2 +- Examples/Charts/Cxx/GraphItem.cxx | 2 +- .../Emscripten/Cxx/MultiCone/MultiCone.cxx | 5 +- .../WrappedAsyncClipper.cxx | 64 ++- .../WrappedAsyncClipper/WrappedAsyncClipper.h | 22 +- .../Cxx/WrappedMace/WrappedMace.cxx | 21 +- Examples/GUI/Cocoa/CustomLayer.mm | 4 +- Examples/GUI/Cocoa/CustomView.h | 2 +- Examples/GUI/Cocoa/MyWindowController.mm | 18 +- Examples/GUI/QML/QtQuickProperty/main.cpp | 26 +- .../GUI/Qt/CellGridSource/CellGridSource.cxx | 52 +- .../GLPaint/Classes/MyGLKViewController.mm | 8 +- .../Surfaces/Classes/MyGLKViewController.mm | 6 +- .../Classes/MyGLKViewController.mm | 6 +- .../Cxx/TestAMRGhostLayerStripping.cxx | 2 +- .../vtkCellGridToUnstructuredGrid.cxx | 16 +- Filters/CellGrid/vtkDGCellCenterResponder.cxx | 54 +- Filters/CellGrid/vtkDGCellSourceResponder.cxx | 5 +- Filters/CellGrid/vtkDGElevationResponder.cxx | 3 +- Filters/CellGrid/vtkDGEvaluator.cxx | 29 +- Filters/CellGrid/vtkDGOperationEvaluator.h | 3 +- .../CellGrid/vtkDGTranscribeCellGridCells.cxx | 28 +- Filters/CellGrid/vtkDGTransformResponder.cxx | 40 +- Filters/CellGrid/vtkDGWarp.cxx | 24 +- .../TestAttributeDataToTableHyperTreeGrid.cxx | 3 +- .../Testing/Cxx/TestConnectivityFilter.cxx | 6 +- Filters/Core/Testing/Cxx/TestDelaunay2D.cxx | 2 +- .../Cxx/TestDelaunay2DBestFittingPlane.cxx | 2 +- .../vtkAppendPartitionedDataSetCollection.cxx | 3 +- .../Core/vtkAttributeDataToTableFilter.cxx | 60 ++- Filters/Core/vtkCellDataToPointData.cxx | 3 +- .../Core/vtkConstrainedSmoothingFilter.cxx | 3 +- Filters/Core/vtkCutter.cxx | 3 +- Filters/Core/vtkDataSetToDataObjectFilter.cxx | 3 +- Filters/Core/vtkExtractCells.cxx | 179 ++++--- Filters/Core/vtkExtractEdges.cxx | 24 +- Filters/Core/vtkHull.cxx | 48 +- Filters/Core/vtkHyperTreeGridProbeFilter.cxx | 3 +- .../vtkHyperTreeGridProbeFilterUtilities.cxx | 12 +- Filters/Core/vtkOrientPolyData.cxx | 3 +- Filters/Core/vtkPlaneCutter.cxx | 12 +- .../vtkPolyDataEdgeConnectivityFilter.cxx | 2 +- Filters/Core/vtkPolyDataNormals.cxx | 100 ++-- Filters/Core/vtkPolyDataPlaneClipper.cxx | 14 +- Filters/Core/vtkPolyDataPlaneCutter.cxx | 20 +- .../Core/vtkPolyDataToUnstructuredGrid.cxx | 43 +- Filters/Core/vtkSplitSharpEdgesPolyData.cxx | 30 +- .../Core/vtkStaticCleanUnstructuredGrid.cxx | 24 +- Filters/Core/vtkStructuredDataPlaneCutter.cxx | 26 +- Filters/Core/vtkSurfaceNets2D.cxx | 24 +- Filters/Core/vtkSurfaceNets3D.cxx | 31 +- Filters/Core/vtkVectorDot.cxx | 3 +- Filters/Core/vtkVectorNorm.cxx | 14 +- .../Core/vtkWindowedSincPolyDataFilter.cxx | 480 +++++++++--------- .../Cxx/TestExtractRectilinearGrid.cxx | 2 +- .../Extraction/vtkExpandMarkedElements.cxx | 74 +-- Filters/Extraction/vtkExtractSelection.cxx | 138 ++--- .../Extraction/vtkExtractTensorComponents.cxx | 158 +++--- Filters/Extraction/vtkFrustumSelector.cxx | 32 +- Filters/Extraction/vtkSelector.cxx | 32 +- Filters/Extraction/vtkValueSelector.cxx | 128 ++--- Filters/FlowPaths/Testing/Cxx/TestBSPTree.cxx | 2 +- .../Testing/Cxx/TestParallelVectors.cxx | 15 +- .../Testing/Cxx/TestParticleTracers.cxx | 3 +- .../FlowPaths/Testing/Cxx/TestVortexCore.cxx | 9 +- .../vtkLinearTransformCellLocator.cxx | 22 +- Filters/FlowPaths/vtkModifiedBSPTree.cxx | 34 +- Filters/FlowPaths/vtkParticlePathFilter.cxx | 6 +- Filters/FlowPaths/vtkStreaklineFilter.cxx | 3 +- Filters/FlowPaths/vtkStreamTracer.cxx | 62 +-- Filters/General/vtkAnimateModes.cxx | 35 +- Filters/General/vtkCleanUnstructuredGrid.cxx | 14 +- Filters/General/vtkClipDataSet.cxx | 3 +- Filters/General/vtkContourTriangulator.cxx | 2 +- .../General/vtkDataSetGradientPrecompute.cxx | 2 +- Filters/General/vtkDeflectNormals.cxx | 8 +- Filters/General/vtkDistancePolyDataFilter.cxx | 101 ++-- Filters/General/vtkMergeTimeFilter.cxx | 5 +- Filters/General/vtkRemovePolyData.cxx | 12 +- .../vtkSpatioTemporalHarmonicsAttribute.cxx | 40 +- Filters/General/vtkTableBasedClipDataSet.cxx | 29 +- Filters/General/vtkTableFFT.cxx | 24 +- Filters/General/vtkTemporalPathLineFilter.cxx | 8 +- Filters/General/vtkWarpScalar.cxx | 66 +-- Filters/General/vtkWarpVector.cxx | 38 +- .../Generic/Testing/Cxx/TestGenericClip.cxx | 4 +- .../Cxx/TestGenericDataSetTessellator.cxx | 4 +- .../Testing/Cxx/TestGenericGeometryFilter.cxx | 2 +- .../Testing/Cxx/TestGenericProbeFilter.cxx | 4 +- .../Testing/Cxx/TestGenericStreamTracer.cxx | 2 +- .../Cxx/TestStructuredAMRGridConnectivity.cxx | 2 +- .../Cxx/TestStructuredGridConnectivity.cxx | 2 +- .../TestUnstructuredGridGeometryFilter.cxx | 6 +- .../Geometry/vtkAttributeSmoothingFilter.cxx | 14 +- Filters/Geometry/vtkDataSetSurfaceFilter.cxx | 17 +- Filters/Geometry/vtkGeometryFilter.cxx | 38 +- .../Geometry/vtkRecoverGeometryWireframe.cxx | 3 +- .../vtkUnstructuredGridGeometryFilter.cxx | 24 +- .../vtkOctreeImageToPointSetFilter.cxx | 28 +- .../vtkPointSetToOctreeImageFilter.cxx | 38 +- .../Testing/Cxx/TestTemporalCacheMemkind.cxx | 5 +- .../Testing/Cxx/TestTemporalCacheSimple.cxx | 5 +- Filters/Hybrid/vtkPCAAnalysisFilter.cxx | 2 +- ...eeGridTernarySphereMaterialReflections.cxx | 2 +- .../vtkHyperTreeGridEvaluateCoarse.cxx | 3 +- .../vtkHyperTreeGridFeatureEdges.cxx | 20 +- .../vtkHyperTreeGridGeometry3DImpl.cxx | 63 +-- .../HyperTree/vtkHyperTreeGridThreshold.cxx | 3 +- .../Testing/Cxx/TestPolyDataPointSampler.cxx | 2 +- .../Testing/Cxx/TestSelectEnclosedPoints.cxx | 2 +- .../vtkBandedPolyDataContourFilter.cxx | 7 +- Filters/Parallel/vtkExtractCTHPart.h | 2 +- .../Parallel/vtkExtractUserDefinedPiece.cxx | 2 +- .../Parallel/vtkHyperTreeGridPProbeFilter.cxx | 6 +- Filters/Parallel/vtkIntegrateAttributes.cxx | 13 +- Filters/Parallel/vtkPKdTree.cxx | 2 +- .../TestPStructuredGridGhostDataGenerator.cxx | 2 +- .../TestPUniformGridGhostDataGenerator.cxx | 2 +- .../Testing/Cxx/TestProbeLineFilter.cxx | 6 +- .../TestStructuredGridGhostDataGenerator.cxx | 2 +- .../vtkAdaptiveResampleToImage.cxx | 95 ++-- .../ParallelDIY2/vtkDIYKdTreeUtilities.cxx | 42 +- .../ParallelDIY2/vtkExtractSubsetWithSeed.cxx | 172 ++++--- Filters/ParallelDIY2/vtkGenerateGlobalIds.cxx | 173 ++++--- .../vtkNativePartitioningStrategy.cxx | 44 +- .../vtkOverlappingCellsDetector.cxx | 122 +++-- .../ParallelDIY2/vtkPResampleWithDataSet.cxx | 10 +- Filters/ParallelDIY2/vtkProbeLineFilter.cxx | 207 ++++---- .../vtkRedistributeDataSetFilter.cxx | 42 +- .../vtkStitchImageDataWithGhosts.cxx | 3 +- .../ParallelFlowPaths/vtkPStreamTracer.cxx | 5 +- .../Testing/Cxx/TestImplicitConnectivity.cxx | 20 +- Filters/Points/vtkMaskPointsFilter.cxx | 52 +- Filters/Points/vtkPointCloudFilter.cxx | 38 +- Filters/Points/vtkProjectPointsToPlane.cxx | 58 ++- ...kToImplicitRamerDouglasPeuckerStrategy.cxx | 8 +- Filters/SMP/vtkSMPMergePolyDataHelper.cxx | 14 +- .../vtkHyperTreeGridPreConfiguredSource.cxx | 4 +- .../vtkPartitionedDataSetCollectionSource.cxx | 22 +- .../Sources/vtkRandomHyperTreeGridSource.cxx | 4 +- Filters/Sources/vtkSelectionSource.cxx | 5 +- .../vtkSpatioTemporalHarmonicsSource.cxx | 3 +- Filters/Statistics/vtkLengthDistribution.cxx | 3 +- Filters/Temporal/vtkCriticalTime.cxx | 100 ++-- Filters/Verdict/vtkBoundaryMeshQuality.cxx | 141 ++--- GUISupport/Qt/QVTKOpenGLNativeWidget.cxx | 5 +- GUISupport/Qt/QVTKOpenGLWindow.cxx | 5 +- GUISupport/Qt/vtkQWidgetTexture.cxx | 3 +- GUISupport/QtQuick/QQuickVTKItem.cxx | 78 ++- GUISupport/QtQuick/QQuickVTKRenderWindow.cxx | 3 +- .../QtQuick/Testing/Cxx/TestQQuickCommon.cxx | 45 +- .../Testing/Cxx/TestIOADIOS2VTX_VTI3D.cxx | 3 +- .../Testing/Cxx/TestIOADIOS2VTX_VTU3D.cxx | 3 +- IO/ADIOS2/Testing/Cxx/UnitTestIOADIOS2VTX.cxx | 12 +- IO/ADIOS2/VTX/schema/VTXSchema.cxx | 5 +- IO/ADIOS2/VTX/schema/vtk/VTXvtkVTI.cxx | 8 +- IO/ADIOS2/VTX/schema/vtk/VTXvtkVTU.cxx | 5 +- IO/AMR/vtkAMRVelodyneReaderInternal.h | 2 +- IO/CGNS/vtkCGNSReader.cxx | 7 +- IO/CGNS/vtkCONVERGECFDCGNSReader.cxx | 5 +- IO/CONVERGECFD/vtkCONVERGECFDReader.cxx | 5 +- IO/CatalystConduit/vtkConduitSource.cxx | 9 +- IO/Cesium3DTiles/TreeInformation.cxx | 60 +-- IO/Core/vtkResourceParser.cxx | 30 +- IO/Core/vtkResourceParser.h | 6 +- IO/Core/vtkURI.cxx | 12 +- IO/ERF/vtkERFReader.cxx | 3 +- IO/EnSight/core/EnSightDataSet.cxx | 23 +- IO/EnSight/vtkEnSight6BinaryReader.cxx | 3 +- IO/EnSight/vtkEnSightGoldBinaryReader.cxx | 14 +- IO/Exodus/Testing/Cxx/TestInSituExodus.cxx | 6 +- .../vtkCPExodusIIResultsArrayTemplate.txx | 2 +- IO/Exodus/vtkExodusIICache.cxx | 2 +- IO/Export/vtkX3DExporterFIWriter.cxx | 2 +- IO/Export/vtkX3DExporterFIWriterHelper.h | 8 +- .../Testing/Cxx/TestPDFTransformedText.cxx | 3 +- IO/FDS/vtkFDSReader.cxx | 7 +- .../Cxx/TestFFMPEGVideoSourceWithAudio.cxx | 3 +- .../Testing/Cxx/TestOBJReaderGroups.cxx | 3 +- IO/Geometry/vtkChacoReader.cxx | 8 +- IO/Geometry/vtkFLUENTReader.cxx | 18 +- .../vtkGLTFDocumentLoaderInternals.cxx | 8 +- IO/Geometry/vtkHoudiniPolyDataWriter.cxx | 15 +- IO/Geometry/vtkMFIXReader.cxx | 6 +- IO/Geometry/vtkOBJReader.cxx | 3 +- IO/Geometry/vtkOpenFOAMReader.cxx | 42 +- IO/Geometry/vtkTecplotReader.cxx | 4 +- IO/H5part/vtkH5PartReader.cxx | 5 +- IO/HDF/Testing/Cxx/TestHDFReaderTemporal.cxx | 29 +- IO/HDF/vtkHDFReader.cxx | 8 +- IO/HDF/vtkHDFUtilities.txx | 12 +- IO/HDFTools/vtkHDF5ScopedHandle.h | 5 +- IO/IOSS/vtkIOSSCellGridReaderInternal.cxx | 25 +- IO/IOSS/vtkIOSSFilesScanner.cxx | 14 +- IO/IOSS/vtkIOSSModel.cxx | 146 +++--- IO/IOSS/vtkIOSSReaderInternal.cxx | 19 +- IO/IOSS/vtkIOSSReaderInternal.h | 7 +- IO/Image/vtkMRCReader.cxx | 2 +- IO/Image/vtkOMETIFFReader.cxx | 12 +- IO/Image/vtkSEPReader.cxx | 9 +- IO/Image/vtkTGAReader.cxx | 3 +- IO/Legacy/vtkPolyDataReader.cxx | 3 +- IO/MINC/vtkMINCImageReader.cxx | 2 +- .../vtkMPIMultiBlockPLOT3DReader.cxx | 5 +- .../Cxx/TestMotionFXCFGReader2Gears.cxx | 3 +- .../Cxx/TestMotionFXCFGReaderClover.cxx | 3 +- .../Cxx/TestMotionFXCFGReaderPlanetary.cxx | 3 +- .../Cxx/TestMotionFXCFGReaderPositionFile.cxx | 3 +- IO/MotionFX/vtkMotionFXCFGReader.cxx | 57 ++- IO/MySQL/vtkMySQLQuery.cxx | 5 +- IO/NetCDF/vtkSLACReader.cxx | 10 +- IO/OpenVDB/vtkOpenVDBReader.cxx | 5 +- IO/ParallelExodus/vtkPExodusIIReader.cxx | 2 +- IO/ParallelNetCDF/vtkPSLACReader.cxx | 8 +- IO/PostgreSQL/vtkPostgreSQLQuery.cxx | 6 +- IO/Video/vtkWin32VideoSource.cxx | 6 +- IO/Xdmf2/vtkXdmfWriter.cxx | 5 +- IO/Xdmf3/vtkXdmf3ArraySelection.h | 2 +- Imaging/Core/Testing/Cxx/TestImageSSIM.cxx | 3 +- Imaging/Core/vtkImageInterpolatorInternals.h | 12 +- Imaging/Core/vtkImageResize.cxx | 5 +- Imaging/Core/vtkImageReslice.cxx | 4 +- Imaging/Core/vtkImageSSIM.cxx | 14 +- .../Hybrid/vtkSurfaceReconstructionFilter.cxx | 6 +- Infovis/Core/Testing/Cxx/TestTableToGraph.cxx | 2 +- Infovis/Core/vtkWordCloud.cxx | 5 +- .../Testing/Cxx/TestSphereHandleWidget.cxx | 2 +- .../vtkImplicitAnnulusRepresentation.cxx | 15 +- .../Testing/Cxx/TestThreadedCallbackQueue.cxx | 11 +- .../Testing/Cxx/TestThreadedTaskQueue.cxx | 3 +- Parallel/Core/vtkCommunicator.cxx | 5 +- Parallel/Core/vtkSocketCommunicator.cxx | 2 +- Parallel/DIY/Testing/Cxx/TestDIYUtilities.cxx | 40 +- Parallel/DIY/vtkDIYDataExchanger.cxx | 33 +- Parallel/DIY/vtkDIYGhostUtilities.txx | 65 +-- .../Cxx/ExerciseMultiProcessController.cxx | 3 +- .../Core/Testing/Cxx/TestBlockVisibility.cxx | 16 +- ...TestCompositePolyDataMapperPickability.cxx | 20 +- ...PolyDataMapperToggleScalarVisibilities.cxx | 102 ++-- .../Core/Testing/Cxx/TestGlyph3DMapper.cxx | 2 +- .../Testing/Cxx/TestGlyph3DMapperArrow.cxx | 2 +- .../Testing/Cxx/TestGlyph3DMapperMasking.cxx | 2 +- .../Cxx/TestGlyph3DMapperOrientationArray.cxx | 2 +- .../Cxx/TestViewDependentErrorMetric.cxx | 2 +- Rendering/Core/vtkBillboardTextActor3D.cxx | 2 +- Rendering/Core/vtkCompositePolyDataMapper.cxx | 3 +- Rendering/Core/vtkStateStorage.h | 2 +- Rendering/Core/vtkStereoCompositor.cxx | 75 +-- Rendering/LICOpenGL2/vtkLICNoiseHelper.cxx | 6 +- .../LICOpenGL2/vtkSurfaceLICComposite.cxx | 7 +- .../Cxx/TestLabelPlacementMapper2D.cxx | 2 +- .../Label/Testing/Cxx/TestLabelPlacer2D.cxx | 2 +- .../Testing/Cxx/TestBlockVisibility.cxx | 16 +- .../Testing/Cxx/TestBlurAndSobelPasses.cxx | 2 +- ...estCompositePolyDataMapper2Pickability.cxx | 20 +- .../OpenGL2/Testing/Cxx/TestFluidMapper.cxx | 2 +- .../Testing/Cxx/TestFramebufferHDR.cxx | 2 +- .../Cxx/TestGlyph3DMapperPickability.cxx | 20 +- .../Testing/Cxx/TestPointGaussianMapper.cxx | 4 +- .../Cxx/TestSobelGradientMagnitudePass.cxx | 2 +- .../OpenGL2/Testing/Cxx/TestUserShader2D.cxx | 10 +- Rendering/OpenGL2/vtkCocoaGLView.mm | 2 +- Rendering/OpenGL2/vtkDualDepthPeelingPass.cxx | 6 +- Rendering/OpenGL2/vtkEDLShading.cxx | 2 +- Rendering/OpenGL2/vtkEGLRenderWindow.cxx | 3 +- Rendering/OpenGL2/vtkGaussianBlurPass.cxx | 2 +- Rendering/OpenGL2/vtkOSOpenGLRenderWindow.cxx | 3 +- Rendering/OpenGL2/vtkOpenGLCellToVTKCellMap.h | 4 +- .../OpenGL2/vtkOpenGLES30PolyDataMapper2D.cxx | 3 +- Rendering/OpenGL2/vtkOpenGLFXAAFilter.cxx | 2 +- .../OpenGL2/vtkOpenGLHardwareSelector.cxx | 2 +- .../vtkOpenGLLowMemoryPolyDataMapper.cxx | 12 +- Rendering/OpenGL2/vtkOpenGLPolyDataMapper.cxx | 18 +- .../OpenGL2/vtkOpenGLVertexBufferObject.h | 3 +- Rendering/OpenGL2/vtkPixelBufferObject.cxx | 4 +- Rendering/OpenGL2/vtkShadowMapBakerPass.cxx | 6 +- Rendering/OpenGL2/vtkShadowMapPass.cxx | 4 +- .../OpenGL2/vtkSobelGradientMagnitudePass.cxx | 2 +- Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx | 3 +- Rendering/OpenXR/vtkOpenXRManager.cxx | 6 +- Rendering/OpenXR/vtkOpenXRManager.h | 3 +- .../vtkOpenXRRenderWindowInteractor.cxx | 3 +- Rendering/Parallel/vtkCompositeRGBAPass.cxx | 4 +- Rendering/Parallel/vtkCompositeZPass.cxx | 4 +- Rendering/Tk/vtkTkImageViewerWidget.cxx | 3 +- Rendering/Tk/vtkTkRenderWidget.cxx | 6 +- .../UI/vtkWin32RenderWindowInteractor.cxx | 2 +- Rendering/VR/vtkVRCollaborationClient.cxx | 3 +- Rendering/VR/vtkVRInteractorStyle.cxx | 54 +- .../vtkUnstructuredGridVolumeZSweepMapper.cxx | 6 +- .../TestGPURayCastDepthPeelingBoxWidget.cxx | 2 +- .../vtkOpenGLGPUVolumeRayCastMapper.cxx | 5 +- .../vtkOpenGLProjectedTetrahedraMapper.cxx | 3 +- ...ebGPUComputePassBufferStorageInternals.cxx | 3 +- ...bGPUComputePassTextureStorageInternals.cxx | 8 +- .../WebGPU/Testing/Cxx/TestComputePass.cxx | 3 +- .../Testing/Cxx/TestComputePassChained.cxx | 3 +- .../Testing/Cxx/TestComputePassUniform.cxx | 3 +- .../Testing/Cxx/TestComputePipeline.cxx | 3 +- .../Cxx/TestComputePipelineRelease.cxx | 3 +- .../Cxx/TestComputePipelineUniform.cxx | 3 +- .../WebGPU/Testing/Cxx/TestComputeTexture.cxx | 3 +- Rendering/WebGPU/vtkWebGPUConfiguration.cxx | 5 +- .../WebGPU/vtkWebGPUHardwareSelector.cxx | 2 +- Rendering/WebGPU/vtkWebGPUHelpers.cxx | 149 +++--- Rendering/WebGPU/vtkWebGPURenderWindow.cxx | 3 +- .../vtkZSpaceCoreCompatibilitySDKManager.cxx | 6 +- Rendering/ZSpace/vtkZSpaceCoreSDKManager.cxx | 6 +- Serialization/Manager/vtkObjectManager.cxx | 3 +- .../Testing/Cxx/TestDataObjectCompare.cxx | 3 +- Testing/Core/vtkTestUtilities.cxx | 49 +- Testing/GenericBridge/vtkBridgeExport.h | 2 +- Testing/Rendering/vtkTesting.cxx | 21 +- Utilities/Benchmarks/vtkRenderTimings.cxx | 2 +- Utilities/DICOMParser/DICOMAppHelper.cxx | 10 +- Utilities/DICOMParser/DICOMFile.cxx | 3 +- .../vtkPythonInterpreter.cxx | 5 +- .../Cxx/TestInteractorStyleTreeMapHover.cxx | 2 +- Views/Infovis/Testing/Cxx/TestRenderView.cxx | 2 +- Views/Infovis/vtkDendrogramItem.cxx | 4 +- Views/Infovis/vtkHeatmapItem.cxx | 10 +- Web/Core/vtkDataEncoder.cxx | 22 +- Web/WebAssembly/vtkWasmSceneManager.cxx | 20 +- Wrapping/PythonCore/vtkPythonArgs.cxx | 15 +- Wrapping/PythonCore/vtkPythonUtil.cxx | 6 +- 407 files changed, 4695 insertions(+), 3729 deletions(-) diff --git a/Accelerators/Vtkm/Core/Testing/Cxx/TestVTKMDataArray.cxx b/Accelerators/Vtkm/Core/Testing/Cxx/TestVTKMDataArray.cxx index b2f39c38179..7e5dd6d6894 100644 --- a/Accelerators/Vtkm/Core/Testing/Cxx/TestVTKMDataArray.cxx +++ b/Accelerators/Vtkm/Core/Testing/Cxx/TestVTKMDataArray.cxx @@ -111,7 +111,8 @@ void TestWithArrayHandle(const ArrayHandleType& vtkmArray) } } - auto dispatchCheck = [&](auto* dispatchedArray) { + auto dispatchCheck = [&](auto* dispatchedArray) + { vtkDataArrayAccessor<std::remove_pointer_t<decltype(dispatchedArray)>> accessor( dispatchedArray); diff --git a/Accelerators/Vtkm/Core/vtkmlib/DataArrayConverters.h b/Accelerators/Vtkm/Core/vtkmlib/DataArrayConverters.h index 9fda46812e4..ba9b904b871 100644 --- a/Accelerators/Vtkm/Core/vtkmlib/DataArrayConverters.h +++ b/Accelerators/Vtkm/Core/vtkmlib/DataArrayConverters.h @@ -60,12 +60,14 @@ vtkm::cont::ArrayHandleBasic<T> vtkAOSDataArrayToFlatArrayHandle(vtkAOSDataArray // will still get problems if the `vtkAOSDataArrayTemplate` gets resized. input->Register(nullptr); - auto deleter = [](void* container) { + auto deleter = [](void* container) + { vtkAOSDataArrayTemplate<T>* vtkArray = reinterpret_cast<vtkAOSDataArrayTemplate<T>*>(container); vtkArray->UnRegister(nullptr); }; - auto reallocator = [](void*& memory, void*& container, vtkm::BufferSizeType oldSize, - vtkm::BufferSizeType newSize) { + auto reallocator = + [](void*& memory, void*& container, vtkm::BufferSizeType oldSize, vtkm::BufferSizeType newSize) + { vtkAOSDataArrayTemplate<T>* vtkArray = reinterpret_cast<vtkAOSDataArrayTemplate<T>*>(container); if ((vtkArray->GetVoidPointer(0) != memory) || (vtkArray->GetNumberOfValues() != oldSize)) { @@ -92,13 +94,15 @@ vtkm::cont::ArrayHandleBasic<T> vtkSOADataArrayToComponentArrayHandle( using ContainerPair = std::pair<vtkSOADataArrayTemplate<T>*, int>; ContainerPair* componentInput = new ContainerPair(input, componentIndex); - auto deleter = [](void* container) { + auto deleter = [](void* container) + { ContainerPair* containerPair = reinterpret_cast<ContainerPair*>(container); containerPair->first->UnRegister(nullptr); delete containerPair; }; auto reallocator = [](void*& memory, void*& container, vtkm::BufferSizeType vtkNotUsed(oldSize), - vtkm::BufferSizeType newSize) { + vtkm::BufferSizeType newSize) + { ContainerPair* containerPair = reinterpret_cast<ContainerPair*>(container); containerPair->first->SetNumberOfTuples(newSize); memory = containerPair->first->GetComponentArrayPointer(containerPair->second); diff --git a/Accelerators/Vtkm/Filters/Testing/Cxx/TestVTKMLevelOfDetail.cxx b/Accelerators/Vtkm/Filters/Testing/Cxx/TestVTKMLevelOfDetail.cxx index d71d505d332..af8bbdf3644 100644 --- a/Accelerators/Vtkm/Filters/Testing/Cxx/TestVTKMLevelOfDetail.cxx +++ b/Accelerators/Vtkm/Filters/Testing/Cxx/TestVTKMLevelOfDetail.cxx @@ -69,7 +69,7 @@ * convert LOD_0* -append summary.png */ -//#define LUCY_PATH "/prm/lucy.ply" +// #define LUCY_PATH "/prm/lucy.ply" namespace { diff --git a/Charts/Core/Testing/Cxx/TestChartXYZMarginsRotations.cxx b/Charts/Core/Testing/Cxx/TestChartXYZMarginsRotations.cxx index f12df4d771b..2460dbd7119 100644 --- a/Charts/Core/Testing/Cxx/TestChartXYZMarginsRotations.cxx +++ b/Charts/Core/Testing/Cxx/TestChartXYZMarginsRotations.cxx @@ -75,7 +75,8 @@ int TestChartXYZMarginsRotations(int, char*[]) } pointindex = 0; - auto p = [&table2, &pointindex](float x, float y, float z) { + auto p = [&table2, &pointindex](float x, float y, float z) + { table2->SetValue(pointindex, 0, x * 0.8 + 100.1); table2->SetValue(pointindex, 1, y * 0.8 - 74.9); table2->SetValue(pointindex, 2, z * 0.8 + 50.1); diff --git a/Charts/Core/Testing/Cxx/TestChartXYZUnconstrained.cxx b/Charts/Core/Testing/Cxx/TestChartXYZUnconstrained.cxx index 6f1588935a0..ddceafeec8d 100644 --- a/Charts/Core/Testing/Cxx/TestChartXYZUnconstrained.cxx +++ b/Charts/Core/Testing/Cxx/TestChartXYZUnconstrained.cxx @@ -73,7 +73,8 @@ int TestChartXYZUnconstrained(int, char*[]) } pointindex = 0; - auto p = [&table2, &pointindex](float x, float y, float z) { + auto p = [&table2, &pointindex](float x, float y, float z) + { table2->SetValue(pointindex, 0, x * 0.8 + 100.1); table2->SetValue(pointindex, 1, y * 0.8 - 74.9); table2->SetValue(pointindex, 2, z * 0.8 + 50.1); diff --git a/Charts/Core/vtkChartXYZ.cxx b/Charts/Core/vtkChartXYZ.cxx index 1179f02c40a..d2a677cbb45 100644 --- a/Charts/Core/vtkChartXYZ.cxx +++ b/Charts/Core/vtkChartXYZ.cxx @@ -765,15 +765,17 @@ void vtkChartXYZ::NewDetermineWhichAxesToLabel() // sort the list of axes by state (low enum value to high) and, for standard axes by gradient // (high to low). - axisData.sort([](const std::tuple<AxisState, float, float, int> first, - const std::tuple<AxisState, float, float, int> second) -> bool { - AxisState stateFirst = std::get<0>(first); - AxisState stateSecond = std::get<0>(second); - float absGradientFirst = std::get<1>(first); - float absGradientSecond = std::get<1>(second); - return (stateFirst < stateSecond) || - ((stateFirst == stateSecond) && absGradientFirst > absGradientSecond); - }); + axisData.sort( + [](const std::tuple<AxisState, float, float, int> first, + const std::tuple<AxisState, float, float, int> second) -> bool + { + AxisState stateFirst = std::get<0>(first); + AxisState stateSecond = std::get<0>(second); + float absGradientFirst = std::get<1>(first); + float absGradientSecond = std::get<1>(second); + return (stateFirst < stateSecond) || + ((stateFirst == stateSecond) && absGradientFirst > absGradientSecond); + }); // for each dimension decide where to play labelling for (const auto& it : axisData) @@ -810,8 +812,11 @@ void vtkChartXYZ::NewDetermineWhichAxesToLabel() { for (int j = 0; j < 2; j++) { - vtkVector3f start( - axis == 0 ? 0 : i, axis == 1 ? 0 : (axis == 0) ? i : j, axis == 2 ? 0 : j); + vtkVector3f start(axis == 0 ? 0 : i, + axis == 1 ? 0 + : (axis == 0) ? i + : j, + axis == 2 ? 0 : j); this->Box->TransformPoint(start.GetData(), start.GetData()); diff --git a/Charts/Core/vtkPlotHistogram2D.cxx b/Charts/Core/vtkPlotHistogram2D.cxx index e55d471a6fc..9278aed9c78 100644 --- a/Charts/Core/vtkPlotHistogram2D.cxx +++ b/Charts/Core/vtkPlotHistogram2D.cxx @@ -38,8 +38,9 @@ struct MagnitudeWorker using VecTuple = typename decltype(vecRange)::ConstTupleReferenceType; - vtkSMPTools::Transform( - vecRange.cbegin(), vecRange.cend(), magRange.begin(), [](const VecTuple& tuple) { + vtkSMPTools::Transform(vecRange.cbegin(), vecRange.cend(), magRange.begin(), + [](const VecTuple& tuple) + { double mag = 0.0; for (const auto comp : tuple) { diff --git a/Common/Core/SMP/STDThread/vtkSMPThreadPool.cxx b/Common/Core/SMP/STDThread/vtkSMPThreadPool.cxx index 184e977f537..3c86abb564e 100644 --- a/Common/Core/SMP/STDThread/vtkSMPThreadPool.cxx +++ b/Common/Core/SMP/STDThread/vtkSMPThreadPool.cxx @@ -339,37 +339,38 @@ vtkSMPThreadPool::ThreadData* vtkSMPThreadPool::GetCallerThreadData() const noex std::thread vtkSMPThreadPool::MakeThread() { - return std::thread{ [this]() { - while (!this->Initialized.load(std::memory_order_acquire)) + return std::thread{ [this]() { - } - - ThreadData& threadData = *this->GetCallerThreadData(); - - // Main loop for threads of the pool - // When they are woke up, they check for new job and stop if "this->Joining" is true - // and no more jobs are running - while (true) - { - std::unique_lock<std::mutex> lock{ threadData.Mutex }; + while (!this->Initialized.load(std::memory_order_acquire)) + { + } - // Job stealing could be implemented but it will requires some changes in the process - // A thread that as no longer work to do could look at other threads jobs to "steal" a job - // from them and thus increase parallelism. This must take care of not generating deadlocks - // and should not increase Proxy parallelism above requested thread count. - // This goes out of the scope of current implementation. - threadData.ConditionVariable.wait(lock, [this, &threadData] { - return !threadData.Jobs.empty() || this->Joining.load(std::memory_order_acquire); - }); + ThreadData& threadData = *this->GetCallerThreadData(); - if (threadData.Jobs.empty()) + // Main loop for threads of the pool + // When they are woke up, they check for new job and stop if "this->Joining" is true + // and no more jobs are running + while (true) { - break; // joining - } + std::unique_lock<std::mutex> lock{ threadData.Mutex }; + + // Job stealing could be implemented but it will requires some changes in the process + // A thread that as no longer work to do could look at other threads jobs to "steal" a job + // from them and thus increase parallelism. This must take care of not generating deadlocks + // and should not increase Proxy parallelism above requested thread count. + // This goes out of the scope of current implementation. + threadData.ConditionVariable.wait(lock, + [this, &threadData] + { return !threadData.Jobs.empty() || this->Joining.load(std::memory_order_acquire); }); + + if (threadData.Jobs.empty()) + { + break; // joining + } - RunJob(threadData, threadData.Jobs.size() - 1, lock); - } - } }; + RunJob(threadData, threadData.Jobs.size() - 1, lock); + } + } }; } void vtkSMPThreadPool::FillThreadsForNestedProxy(ProxyData* proxy, std::size_t maxCount) @@ -383,7 +384,8 @@ void vtkSMPThreadPool::FillThreadsForNestedProxy(ProxyData* proxy, std::size_t m return; // No thread will be available } - const auto isFree = [proxy](ThreadData* threadData) { + const auto isFree = [proxy](ThreadData* threadData) + { for (auto* parent = proxy->Parent; parent != nullptr; parent = parent->Parent) { for (auto& proxyThread : parent->Threads) diff --git a/Common/Core/Testing/Cxx/TestArrayFreeFunctions.cxx b/Common/Core/Testing/Cxx/TestArrayFreeFunctions.cxx index 445be995fc1..c3c0629ff6f 100644 --- a/Common/Core/Testing/Cxx/TestArrayFreeFunctions.cxx +++ b/Common/Core/Testing/Cxx/TestArrayFreeFunctions.cxx @@ -97,10 +97,12 @@ void assign_user_free(FreeType, vtkAbstractArray*) void assign_user_free(UseLambda, vtkAbstractArray* array) { - array->SetArrayFreeFunction([](void* ptr) { - delete[] reinterpret_cast<uint8_t*>(ptr); - timesLambdaFreeCalled++; - }); + array->SetArrayFreeFunction( + [](void* ptr) + { + delete[] reinterpret_cast<uint8_t*>(ptr); + timesLambdaFreeCalled++; + }); } //------------------------------------------------------------------------------ diff --git a/Common/Core/Testing/Cxx/TestAtomic.cxx b/Common/Core/Testing/Cxx/TestAtomic.cxx index b8cbd9dea7b..3d8feca5f9e 100644 --- a/Common/Core/Testing/Cxx/TestAtomic.cxx +++ b/Common/Core/Testing/Cxx/TestAtomic.cxx @@ -17,7 +17,7 @@ static int NumThreads = 5; // uncomment the following line if you want to see // the difference between using atomics and not -//#define SHOW_DIFFERENCE +// #define SHOW_DIFFERENCE #ifdef SHOW_DIFFERENCE static int Total = 0; static vtkTypeInt64 Total64 = 0; diff --git a/Common/Core/Testing/Cxx/TestSMP.cxx b/Common/Core/Testing/Cxx/TestSMP.cxx index d630b71afb5..2ffe6eda7e2 100644 --- a/Common/Core/Testing/Cxx/TestSMP.cxx +++ b/Common/Core/Testing/Cxx/TestSMP.cxx @@ -73,12 +73,14 @@ public: for (int i = 0; i < *it; ++i) { vtkSMPThreadLocal<int> nestedCounter(0); - vtkSMPTools::For(0, this->Factor, [&](vtkIdType start, vtkIdType stop) { - for (vtkIdType j = start; j < stop; ++j) + vtkSMPTools::For(0, this->Factor, + [&](vtkIdType start, vtkIdType stop) { - nestedCounter.Local()++; - } - }); + for (vtkIdType j = start; j < stop; ++j) + { + nestedCounter.Local()++; + } + }); for (const auto& el : nestedCounter) { this->Counter.Local() += el; @@ -108,17 +110,19 @@ public: for (int i = begin; i < end; i++) { vtkSMPThreadLocal<int> nestedCounter(0); - vtkSMPTools::For(0, 100, [&](vtkIdType start, vtkIdType stop) { - bool isSingleInner = vtkSMPTools::GetSingleThread(); - if (!isSingleInner) - { - return; - } - for (vtkIdType j = start; j < stop; ++j) + vtkSMPTools::For(0, 100, + [&](vtkIdType start, vtkIdType stop) { - nestedCounter.Local()++; - } - }); + bool isSingleInner = vtkSMPTools::GetSingleThread(); + if (!isSingleInner) + { + return; + } + for (vtkIdType j = start; j < stop; ++j) + { + nestedCounter.Local()++; + } + }); for (const auto& el : nestedCounter) { @@ -246,12 +250,14 @@ int doTestSMP() { vtkSMPThreadLocal<int> isParallel(0); int target = 20; - vtkSMPTools::For(0, target, 1, [&](vtkIdType start, vtkIdType end) { - for (vtkIdType i = start; i < end; ++i) + vtkSMPTools::For(0, target, 1, + [&](vtkIdType start, vtkIdType end) { - isParallel.Local() += static_cast<int>(vtkSMPTools::IsParallelScope()); - } - }); + for (vtkIdType i = start; i < end; ++i) + { + isParallel.Local() += static_cast<int>(vtkSMPTools::IsParallelScope()); + } + }); total = 0; for (const auto& it : isParallel) { @@ -420,7 +426,8 @@ int doTestSMP() using TupleRef = typename decltype(transformRange4)::const_reference; using ValueType = typename decltype(transformRange5)::ValueType; - auto computeMag = [](const TupleRef& tuple) -> ValueType { + auto computeMag = [](const TupleRef& tuple) -> ValueType + { ValueType mag = 0; for (const auto& comp : tuple) { diff --git a/Common/Core/Testing/Cxx/TestSortDataArray.cxx b/Common/Core/Testing/Cxx/TestSortDataArray.cxx index c68f9ec78e5..acd0f929420 100644 --- a/Common/Core/Testing/Cxx/TestSortDataArray.cxx +++ b/Common/Core/Testing/Cxx/TestSortDataArray.cxx @@ -13,7 +13,7 @@ #include <locale> // C++ locale #include <sstream> -//#define ARRAY_SIZE (2*1024*1024) +// #define ARRAY_SIZE (2*1024*1024) #define ARRAY_SIZE 2048 int TestSortDataArray(int, char*[]) diff --git a/Common/Core/vtkAbstractArray.h b/Common/Core/vtkAbstractArray.h index 382cc480112..2df39d3b005 100644 --- a/Common/Core/vtkAbstractArray.h +++ b/Common/Core/vtkAbstractArray.h @@ -772,7 +772,10 @@ VTK_ABI_NAMESPACE_END template <> \ struct vtkArrayDownCast_impl<ArrayT> \ { \ - inline ArrayT* operator()(vtkAbstractArray* array) { return ArrayT::FastDownCast(array); } \ + inline ArrayT* operator()(vtkAbstractArray* array) \ + { \ + return ArrayT::FastDownCast(array); \ + } \ } ///@} diff --git a/Common/Core/vtkAutoInit.h b/Common/Core/vtkAutoInit.h index c57a5197039..0c03c637636 100644 --- a/Common/Core/vtkAutoInit.h +++ b/Common/Core/vtkAutoInit.h @@ -18,7 +18,10 @@ static struct M##_AutoInit \ { \ /* Call every <mod>_AutoInit_Construct during initialization. */ \ - M##_AutoInit() { VTK_AUTOINIT_CONSTRUCT_##T } \ + M##_AutoInit() \ + { \ + VTK_AUTOINIT_CONSTRUCT_##T \ + } \ } M##_AutoInit_Instance; /* NOLINT(misc-definitions-in-headers) */ \ } @@ -81,7 +84,10 @@ static struct M##_ModuleInit \ { \ /* Call <mod>_AutoInit_Construct during initialization. */ \ - M##_ModuleInit() { VTK_AUTOINIT_CONSTRUCT(M) } \ + M##_ModuleInit() \ + { \ + VTK_AUTOINIT_CONSTRUCT(M) \ + } \ } M##_ModuleInit_Instance; \ } diff --git a/Common/Core/vtkBatch.h b/Common/Core/vtkBatch.h index 0a5c609c8a3..0f6506407ee 100644 --- a/Common/Core/vtkBatch.h +++ b/Common/Core/vtkBatch.h @@ -79,16 +79,18 @@ public: this->Batches.resize(static_cast<size_t>(numberOfBatches)); const auto lastBatchId = numberOfBatches - 1; - vtkSMPTools::For(0, numberOfBatches, [&](vtkIdType beginBatchId, vtkIdType endBatchId) { - vtkIdType endIdValues[2] = { -1, numberOfElements }; - for (vtkIdType batchId = beginBatchId; batchId < endBatchId; ++batchId) + vtkSMPTools::For(0, numberOfBatches, + [&](vtkIdType beginBatchId, vtkIdType endBatchId) { - auto& batch = this->Batches[batchId]; - batch.BeginId = batchId * batchSizeSigned; - endIdValues[0] = (batchId + 1) * batchSizeSigned; - batch.EndId = endIdValues[batchId == lastBatchId]; - } - }); + vtkIdType endIdValues[2] = { -1, numberOfElements }; + for (vtkIdType batchId = beginBatchId; batchId < endBatchId; ++batchId) + { + auto& batch = this->Batches[batchId]; + batch.BeginId = batchId * batchSizeSigned; + endIdValues[0] = (batchId + 1) * batchSizeSigned; + batch.EndId = endIdValues[batchId == lastBatchId]; + } + }); } /** @@ -110,18 +112,21 @@ public: tlInterEndBatchId.resize(static_cast<size_t>(numberOfThreads)); // perform batch trimming of batch segments - vtkSMPTools::For(0, numberOfThreads, [&](vtkIdType beginThreadId, vtkIdType endThreadId) { - for (vtkIdType threadId = beginThreadId; threadId < endThreadId; ++threadId) + vtkSMPTools::For(0, numberOfThreads, + [&](vtkIdType beginThreadId, vtkIdType endThreadId) { - const vtkIdType beginBatchId = threadId * numberOfBatchesPerThread; - const vtkIdType endBatchId = - threadId != lastThreadId ? (threadId + 1) * numberOfBatchesPerThread : numberOfBatches; - auto beginBatchIter = this->Batches.begin() + beginBatchId; - auto endBatchIter = this->Batches.begin() + endBatchId; - auto newEndBatchIter = std::remove_if(beginBatchIter, endBatchIter, shouldRemoveBatch); - tlInterEndBatchId[threadId] = beginBatchId + std::distance(beginBatchIter, newEndBatchIter); - } - }); + for (vtkIdType threadId = beginThreadId; threadId < endThreadId; ++threadId) + { + const vtkIdType beginBatchId = threadId * numberOfBatchesPerThread; + const vtkIdType endBatchId = + threadId != lastThreadId ? (threadId + 1) * numberOfBatchesPerThread : numberOfBatches; + auto beginBatchIter = this->Batches.begin() + beginBatchId; + auto endBatchIter = this->Batches.begin() + endBatchId; + auto newEndBatchIter = std::remove_if(beginBatchIter, endBatchIter, shouldRemoveBatch); + tlInterEndBatchId[threadId] = + beginBatchId + std::distance(beginBatchIter, newEndBatchIter); + } + }); // compute the new end batch ids; std::vector<vtkIdType> tlNewEndBatchId; tlNewEndBatchId.resize(static_cast<size_t>(numberOfThreads)); @@ -166,20 +171,22 @@ public: std::vector<TBatchData> tlSums; tlSums.resize(static_cast<size_t>(numberOfThreads)); - vtkSMPTools::For(0, numberOfThreads, [&](vtkIdType beginThreadId, vtkIdType endThreadId) { - for (vtkIdType threadId = beginThreadId; threadId < endThreadId; ++threadId) + vtkSMPTools::For(0, numberOfThreads, + [&](vtkIdType beginThreadId, vtkIdType endThreadId) { - const vtkIdType beginBatchId = threadId * numberOfBatchesPerThread; - const vtkIdType endBatchId = - threadId != lastThreadId ? (threadId + 1) * numberOfBatchesPerThread : numberOfBatches; - - auto& threadSum = tlSums[threadId]; - for (vtkIdType batchId = beginBatchId; batchId < endBatchId; ++batchId) + for (vtkIdType threadId = beginThreadId; threadId < endThreadId; ++threadId) { - threadSum += this->Batches[batchId].Data; + const vtkIdType beginBatchId = threadId * numberOfBatchesPerThread; + const vtkIdType endBatchId = + threadId != lastThreadId ? (threadId + 1) * numberOfBatchesPerThread : numberOfBatches; + + auto& threadSum = tlSums[threadId]; + for (vtkIdType batchId = beginBatchId; batchId < endBatchId; ++batchId) + { + threadSum += this->Batches[batchId].Data; + } } - } - }); + }); // calculate the global sum; TBatchData globalSum; @@ -197,28 +204,30 @@ public: } // convert the batch sums to offsets using the thread local offsets - vtkSMPTools::For(0, numberOfThreads, [&](vtkIdType beginThreadId, vtkIdType endThreadId) { - for (vtkIdType threadId = beginThreadId; threadId < endThreadId; ++threadId) + vtkSMPTools::For(0, numberOfThreads, + [&](vtkIdType beginThreadId, vtkIdType endThreadId) { - const vtkIdType beginBatchId = threadId * numberOfBatchesPerThread; - const vtkIdType endBatchId = - threadId != lastThreadId ? (threadId + 1) * numberOfBatchesPerThread : numberOfBatches; - - // store the first batch sum - auto lastBatchData = this->Batches[beginBatchId].Data; - // convert the first batch sum to an offset - this->Batches[beginBatchId].Data = tlOffsets[threadId]; - for (vtkIdType batchId = beginBatchId + 1; batchId < endBatchId; ++batchId) + for (vtkIdType threadId = beginThreadId; threadId < endThreadId; ++threadId) { - // store the current batch sum - const auto currentBatchData = this->Batches[batchId].Data; - // convert the current batch sum to an offset - this->Batches[batchId].Data = this->Batches[batchId - 1].Data + lastBatchData; - // store the current batch sum for the next iteration - lastBatchData = std::move(currentBatchData); + const vtkIdType beginBatchId = threadId * numberOfBatchesPerThread; + const vtkIdType endBatchId = + threadId != lastThreadId ? (threadId + 1) * numberOfBatchesPerThread : numberOfBatches; + + // store the first batch sum + auto lastBatchData = this->Batches[beginBatchId].Data; + // convert the first batch sum to an offset + this->Batches[beginBatchId].Data = tlOffsets[threadId]; + for (vtkIdType batchId = beginBatchId + 1; batchId < endBatchId; ++batchId) + { + // store the current batch sum + const auto currentBatchData = this->Batches[batchId].Data; + // convert the current batch sum to an offset + this->Batches[batchId].Data = this->Batches[batchId - 1].Data + lastBatchData; + // store the current batch sum for the next iteration + lastBatchData = std::move(currentBatchData); + } } - } - }); + }); return globalSum; } diff --git a/Common/Core/vtkByteSwap.cxx b/Common/Core/vtkByteSwap.cxx index 9b96038fda2..4d2874cf83e 100644 --- a/Common/Core/vtkByteSwap.cxx +++ b/Common/Core/vtkByteSwap.cxx @@ -103,7 +103,8 @@ inline bool vtkByteSwapRangeWrite(const T* first, size_t num, FILE* f, long) for (const T* p = first; p != last && result; ++p) { // Use a union to avoid breaking C++ aliasing rules. - union { + union + { T value; char data[sizeof(T)]; } temp = { *p }; @@ -137,7 +138,8 @@ inline void vtkByteSwapRangeWrite(const T* first, size_t num, ostream* os, long) for (const T* p = first; p != last; ++p) { // Use a union to avoid breaking C++ aliasing rules. - union { + union + { T value; char data[sizeof(T)]; } temp = { *p }; @@ -232,10 +234,22 @@ inline void vtkByteSwapLERangeWrite(const T* p, size_t num, ostream* os) //------------------------------------------------------------------------------ #define VTK_BYTE_SWAP_IMPL(T) \ - void vtkByteSwap::SwapLE(T* p) { vtkByteSwapLE(p); } \ - void vtkByteSwap::SwapBE(T* p) { vtkByteSwapBE(p); } \ - void vtkByteSwap::SwapLERange(T* p, size_t num) { vtkByteSwapLERange(p, num); } \ - void vtkByteSwap::SwapBERange(T* p, size_t num) { vtkByteSwapBERange(p, num); } \ + void vtkByteSwap::SwapLE(T* p) \ + { \ + vtkByteSwapLE(p); \ + } \ + void vtkByteSwap::SwapBE(T* p) \ + { \ + vtkByteSwapBE(p); \ + } \ + void vtkByteSwap::SwapLERange(T* p, size_t num) \ + { \ + vtkByteSwapLERange(p, num); \ + } \ + void vtkByteSwap::SwapBERange(T* p, size_t num) \ + { \ + vtkByteSwapBERange(p, num); \ + } \ bool vtkByteSwap::SwapLERangeWrite(const T* p, size_t num, FILE* file) \ { \ return vtkByteSwapLERangeWrite(p, num, file); \ diff --git a/Common/Core/vtkCommand.cxx b/Common/Core/vtkCommand.cxx index bed4e6c5a21..051c6f6ddd8 100644 --- a/Common/Core/vtkCommand.cxx +++ b/Common/Core/vtkCommand.cxx @@ -36,12 +36,13 @@ const char* vtkCommand::GetStringFromEventId(unsigned long event) vtkAllEventsMacro() #undef _vtk_add_event - // clang-format on + // clang-format on - case UserEvent : return "UserEvent"; + case UserEvent: + return "UserEvent"; - case NoEvent: - return "NoEvent"; + case NoEvent: + return "NoEvent"; } // Unknown event. Original code was returning NoEvent, so I'll stick with diff --git a/Common/Core/vtkCompositeImplicitBackend.txx b/Common/Core/vtkCompositeImplicitBackend.txx index 4aa0914ee20..4582d615a69 100644 --- a/Common/Core/vtkCompositeImplicitBackend.txx +++ b/Common/Core/vtkCompositeImplicitBackend.txx @@ -155,26 +155,30 @@ private: void Initialize(Iterator first, Iterator last) { this->CachedArrays.resize(std::distance(first, last)); - std::transform(first, last, this->CachedArrays.begin(), [](vtkDataArray* arr) { - vtkNew<CachedArray> newCache; - newCache->SetBackend(std::make_shared<CachedBackend>(arr)); - newCache->SetNumberOfComponents(1); - if (arr) + std::transform(first, last, this->CachedArrays.begin(), + [](vtkDataArray* arr) { - newCache->SetNumberOfTuples(arr->GetNumberOfTuples() * arr->GetNumberOfComponents()); - } - else - { - newCache->SetNumberOfTuples(0); - } - return newCache; - }); + vtkNew<CachedArray> newCache; + newCache->SetBackend(std::make_shared<CachedBackend>(arr)); + newCache->SetNumberOfComponents(1); + if (arr) + { + newCache->SetNumberOfTuples(arr->GetNumberOfTuples() * arr->GetNumberOfComponents()); + } + else + { + newCache->SetNumberOfTuples(0); + } + return newCache; + }); if (this->CachedArrays.size() > 0) { this->Offsets.resize(this->CachedArrays.size() - 1); std::size_t runningSum = 0; std::transform(this->CachedArrays.begin(), this->CachedArrays.end() - 1, - this->Offsets.begin(), [&runningSum](CachedArray* arr) { + this->Offsets.begin(), + [&runningSum](CachedArray* arr) + { runningSum += arr->GetNumberOfTuples(); return runningSum; }); diff --git a/Common/Core/vtkInformation.cxx b/Common/Core/vtkInformation.cxx index ac2afecbd02..2e96fd9a58a 100644 --- a/Common/Core/vtkInformation.cxx +++ b/Common/Core/vtkInformation.cxx @@ -449,12 +449,18 @@ int vtkInformation::Has(vtkInformationRequestKey* key) //------------------------------------------------------------------------------ #define VTK_INFORMATION_DEFINE_SCALAR_PROPERTY(name, type) \ - void vtkInformation::Set(vtkInformation##name##Key* key, type value) { key->Set(this, value); } \ + void vtkInformation::Set(vtkInformation##name##Key* key, type value) \ + { \ + key->Set(this, value); \ + } \ void vtkInformation::Remove(vtkInformation##name##Key* key) \ { \ key->vtkInformation##name##Key::Remove(this); \ } \ - type vtkInformation::Get(vtkInformation##name##Key* key) { return key->Get(this); } \ + type vtkInformation::Get(vtkInformation##name##Key* key) \ + { \ + return key->Get(this); \ + } \ int vtkInformation::Has(vtkInformation##name##Key* key) \ { \ return key->vtkInformation##name##Key::Has(this); \ @@ -481,7 +487,10 @@ VTK_INFORMATION_DEFINE_SCALAR_PROPERTY(Variant, const vtkVariant&); { \ key->Set(this, value, length); \ } \ - type* vtkInformation::Get(vtkInformation##name##VectorKey* key) { return key->Get(this); } \ + type* vtkInformation::Get(vtkInformation##name##VectorKey* key) \ + { \ + return key->Get(this); \ + } \ type vtkInformation::Get(vtkInformation##name##VectorKey* key, int idx) \ { \ return key->Get(this, idx); \ @@ -490,7 +499,10 @@ VTK_INFORMATION_DEFINE_SCALAR_PROPERTY(Variant, const vtkVariant&); { \ key->Get(this, value); \ } \ - int vtkInformation::Length(vtkInformation##name##VectorKey* key) { return key->Length(this); } \ + int vtkInformation::Length(vtkInformation##name##VectorKey* key) \ + { \ + return key->Length(this); \ + } \ void vtkInformation::Remove(vtkInformation##name##VectorKey* key) \ { \ key->vtkInformation##name##VectorKey::Remove(this); \ @@ -664,12 +676,18 @@ VTK_INFORMATION_DEFINE_VECTOR_VALUE2_PROPERTY(Variant, vtkVariant, const vtkVari { \ key->Set(this, value, length); \ } \ - type* vtkInformation::Get(vtkInformation##name##PointerKey* key) { return key->Get(this); } \ + type* vtkInformation::Get(vtkInformation##name##PointerKey* key) \ + { \ + return key->Get(this); \ + } \ void vtkInformation::Get(vtkInformation##name##PointerKey* key, type* value) \ { \ key->Get(this, value); \ } \ - int vtkInformation::Length(vtkInformation##name##PointerKey* key) { return key->Length(this); } \ + int vtkInformation::Length(vtkInformation##name##PointerKey* key) \ + { \ + return key->Length(this); \ + } \ void vtkInformation::Remove(vtkInformation##name##PointerKey* key) \ { \ key->vtkInformation##name##PointerKey::Remove(this); \ diff --git a/Common/Core/vtkInformationKey.h b/Common/Core/vtkInformationKey.h index 8af84c55cd7..47dfecf20fe 100644 --- a/Common/Core/vtkInformationKey.h +++ b/Common/Core/vtkInformationKey.h @@ -198,14 +198,23 @@ private: // definition in the header file. #define vtkInformationKeyMacro(CLASS, NAME, type) \ static vtkInformation##type##Key* CLASS##_##NAME = new vtkInformation##type##Key(#NAME, #CLASS); \ - vtkInformation##type##Key* CLASS::NAME() { return CLASS##_##NAME; } + vtkInformation##type##Key* CLASS::NAME() \ + { \ + return CLASS##_##NAME; \ + } #define vtkInformationKeySubclassMacro(CLASS, NAME, type, super) \ static vtkInformation##type##Key* CLASS##_##NAME = new vtkInformation##type##Key(#NAME, #CLASS); \ - vtkInformation##super##Key* CLASS::NAME() { return CLASS##_##NAME; } + vtkInformation##super##Key* CLASS::NAME() \ + { \ + return CLASS##_##NAME; \ + } #define vtkInformationKeyRestrictedMacro(CLASS, NAME, type, required) \ static vtkInformation##type##Key* CLASS##_##NAME = \ new vtkInformation##type##Key(#NAME, #CLASS, required); \ - vtkInformation##type##Key* CLASS::NAME() { return CLASS##_##NAME; } + vtkInformation##type##Key* CLASS::NAME() \ + { \ + return CLASS##_##NAME; \ + } VTK_ABI_NAMESPACE_END #endif diff --git a/Common/Core/vtkInherits.h b/Common/Core/vtkInherits.h index 2bec3605035..dd49e192f12 100644 --- a/Common/Core/vtkInherits.h +++ b/Common/Core/vtkInherits.h @@ -132,8 +132,7 @@ struct ParentClasses<VTKObjectType, true> template <typename Functor> inline static typename std::enable_if< std::is_same<decltype(std::declval<Functor>().template operator()<vtkObject>()), void>::value, - void>::type - enumerate(Functor& ff) + void>::type enumerate(Functor& ff) { ff.template operator()<VTKObjectType>(); ParentClasses<typename VTKObjectType::Superclass>::enumerate(ff); @@ -143,8 +142,7 @@ struct ParentClasses<VTKObjectType, true> template <typename Functor> inline static typename std::enable_if< std::is_same<decltype(std::declval<Functor>().template operator()<vtkObject>()), bool>::value, - void>::type - enumerate(Functor& ff) + void>::type enumerate(Functor& ff) { if (ff.template operator()<VTKObjectType>()) { diff --git a/Common/Core/vtkMarshalContext.cxx b/Common/Core/vtkMarshalContext.cxx index 1a21b70fea0..3a8345e0b64 100644 --- a/Common/Core/vtkMarshalContext.cxx +++ b/Common/Core/vtkMarshalContext.cxx @@ -228,9 +228,8 @@ vtkTypeUInt32 vtkMarshalContext::GetId(vtkObjectBase* objectBase) const { auto& internals = (*this->Internals); auto objectIter = std::find_if(internals.WeakObjects.begin(), internals.WeakObjects.end(), - [objectBase](const std::pair<const vtkTypeUInt32, vtkWeakPointer<vtkObjectBase>>& item) { - return item.second == objectBase; - }); + [objectBase](const std::pair<const vtkTypeUInt32, vtkWeakPointer<vtkObjectBase>>& item) + { return item.second == objectBase; }); if (objectIter != internals.WeakObjects.end()) { return objectIter->first; diff --git a/Common/Core/vtkObjectFactory.h b/Common/Core/vtkObjectFactory.h index 715d6eac756..9d6fc6a9a1c 100644 --- a/Common/Core/vtkObjectFactory.h +++ b/Common/Core/vtkObjectFactory.h @@ -274,7 +274,10 @@ static vtkObjectFactoryRegistryCleanup vtkObjectFactoryRegistryCleanupInstance; // The name of the function will by vtkObjectFactoryCreateclassname // where classname is the name of the class being created #define VTK_CREATE_CREATE_FUNCTION(classname) \ - static vtkObject* vtkObjectFactoryCreate##classname() { return classname::New(); } + static vtkObject* vtkObjectFactoryCreate##classname() \ + { \ + return classname::New(); \ + } VTK_ABI_NAMESPACE_END #endif @@ -331,7 +334,10 @@ VTK_ABI_NAMESPACE_END // Macro to implement the standard form of the New() method. #define vtkStandardNewMacro(thisClass) \ - thisClass* thisClass::New() { VTK_STANDARD_NEW_BODY(thisClass); } + thisClass* thisClass::New() \ + { \ + VTK_STANDARD_NEW_BODY(thisClass); \ + } // Macro to implement the ExtendedNew() to create an object in a memkind extended memory space. If // VTK is not compiled with VTK_USE_MEMKIND this is equivalent to New() @@ -345,10 +351,16 @@ VTK_ABI_NAMESPACE_END // Macro to implement the object factory form of the New() method. #define vtkObjectFactoryNewMacro(thisClass) \ - thisClass* thisClass::New() { VTK_OBJECT_FACTORY_NEW_BODY(thisClass); } + thisClass* thisClass::New() \ + { \ + VTK_OBJECT_FACTORY_NEW_BODY(thisClass); \ + } // Macro to implement the abstract object factory form of the New() method. // That is an abstract base class that can only be instantiated if the // object factory overrides it. #define vtkAbstractObjectFactoryNewMacro(thisClass) \ - thisClass* thisClass::New() { VTK_ABSTRACT_OBJECT_FACTORY_NEW_BODY(thisClass); } + thisClass* thisClass::New() \ + { \ + VTK_ABSTRACT_OBJECT_FACTORY_NEW_BODY(thisClass); \ + } diff --git a/Common/Core/vtkSetGet.h b/Common/Core/vtkSetGet.h index 14a814a1b8f..7ab772c24eb 100644 --- a/Common/Core/vtkSetGet.h +++ b/Common/Core/vtkSetGet.h @@ -271,8 +271,8 @@ // Get a file path, like vtkGetStringMacro but with VTK_FILEPATH hint. #define vtkGetFilePathMacro(name) \ - virtual VTK_FILEPATH VTK_FUTURE_CONST char* Get##name() \ - VTK_FUTURE_CONST vtkGetStringBodyMacro(name) + virtual VTK_FILEPATH VTK_FUTURE_CONST char* Get##name() VTK_FUTURE_CONST vtkGetStringBodyMacro( \ + name) // This macro defines a body of get string macro. It can be used either in // the header file using vtkGetStringMacro or in the implementation. @@ -366,8 +366,14 @@ this->Modified(); \ } \ } \ - virtual type Get##name##MinValue() { return min; } \ - virtual type Get##name##MaxValue() { return max; } + virtual type Get##name##MinValue() \ + { \ + return min; \ + } \ + virtual type Get##name##MaxValue() \ + { \ + return max; \ + } #define vtkSetClampMacroOverride(name, type, min, max) \ void Set##name(type _arg) override \ { \ @@ -378,8 +384,14 @@ this->Modified(); \ } \ } \ - type Get##name##MinValue() override { return min; } \ - type Get##name##MaxValue() override { return max; } + type Get##name##MinValue() override \ + { \ + return min; \ + } \ + type Get##name##MaxValue() override \ + { \ + return max; \ + } // // This macro defines a body of set object macro. It can be used either in @@ -427,9 +439,15 @@ // be used in the header file. // #define vtkSetObjectMacro(name, type) \ - virtual void Set##name(type* _arg) { vtkSetObjectBodyMacro(name, type, _arg); } + virtual void Set##name(type* _arg) \ + { \ + vtkSetObjectBodyMacro(name, type, _arg); \ + } #define vtkSetObjectMacroOverride(name, type) \ - void Set##name(type* _arg) override { vtkSetObjectBodyMacro(name, type, _arg); } + void Set##name(type* _arg) override \ + { \ + vtkSetObjectBodyMacro(name, type, _arg); \ + } // // Set pointer to a smart pointer class member. @@ -437,9 +455,15 @@ // be used in the header file. // #define vtkSetSmartPointerMacro(name, type) \ - virtual void Set##name(type* _arg) { vtkSetSmartPointerBodyMacro(name, type, _arg); } + virtual void Set##name(type* _arg) \ + { \ + vtkSetSmartPointerBodyMacro(name, type, _arg); \ + } #define vtkSetSmartPointerMacroOverride(name, type) \ - void Set##name(type* _arg) override { vtkSetSmartPointerBodyMacro(name, type, _arg); } + void Set##name(type* _arg) override \ + { \ + vtkSetSmartPointerBodyMacro(name, type, _arg); \ + } // // Set pointer to object; uses vtkObject reference counting methodology. @@ -453,14 +477,20 @@ #define vtkSetObjectImplementationMacro(class, name, type) vtkCxxSetObjectMacro(class, name, type) #define vtkCxxSetObjectMacro(cls, name, type) \ - void cls::Set##name(type* _arg) { vtkSetObjectBodyMacro(name, type, _arg); } + void cls::Set##name(type* _arg) \ + { \ + vtkSetObjectBodyMacro(name, type, _arg); \ + } // // Set pointer to smart pointer. // This macro is used to define the implementation. // #define vtkCxxSetSmartPointerMacro(cls, name, type) \ - void cls::Set##name(type* _arg) { vtkSetSmartPointerBodyMacro(name, type, _arg); } + void cls::Set##name(type* _arg) \ + { \ + vtkSetSmartPointerBodyMacro(name, type, _arg); \ + } // // Get pointer to object wrapped in vtkNew. Creates member Get"name" @@ -495,8 +525,14 @@ // Set method must be defined to use this macro. // #define vtkBooleanMacro(name, type) \ - virtual void name##On() { this->Set##name(static_cast<type>(1)); } \ - virtual void name##Off() { this->Set##name(static_cast<type>(0)); } + virtual void name##On() \ + { \ + this->Set##name(static_cast<type>(1)); \ + } \ + virtual void name##Off() \ + { \ + this->Set##name(static_cast<type>(0)); \ + } // // Following set macros for vectors define two members for each macro. The @@ -516,7 +552,10 @@ this->Modified(); \ } \ } \ - void Set##name(const type _arg[2]) { this->Set##name(_arg[0], _arg[1]); } + void Set##name(const type _arg[2]) \ + { \ + this->Set##name(_arg[0], _arg[1]); \ + } #define vtkSetVector2MacroOverride(name, type) \ void Set##name(type _arg1, type _arg2) override \ { \ @@ -543,7 +582,10 @@ vtkDebugMacro(<< " returning " #name " = (" << _arg1 << "," << _arg2 << ")"); \ } \ VTK_WRAPEXCLUDE \ - virtual void Get##name(type _arg[2]) { this->Get##name(_arg[0], _arg[1]); } + virtual void Get##name(type _arg[2]) \ + { \ + this->Get##name(_arg[0], _arg[1]); \ + } #define vtkSetVector3Macro(name, type) \ virtual void Set##name(type _arg1, type _arg2, type _arg3) \ @@ -557,7 +599,10 @@ this->Modified(); \ } \ } \ - virtual void Set##name(const type _arg[3]) { this->Set##name(_arg[0], _arg[1], _arg[2]); } + virtual void Set##name(const type _arg[3]) \ + { \ + this->Set##name(_arg[0], _arg[1], _arg[2]); \ + } #define vtkSetVector3MacroOverride(name, type) \ void Set##name(type _arg1, type _arg2, type _arg3) override \ { \ @@ -570,7 +615,10 @@ this->Modified(); \ } \ } \ - void Set##name(const type _arg[3]) override { this->Set##name(_arg[0], _arg[1], _arg[2]); } + void Set##name(const type _arg[3]) override \ + { \ + this->Set##name(_arg[0], _arg[1], _arg[2]); \ + } #define vtkGetVector3Macro(name, type) \ virtual type* Get##name() VTK_SIZEHINT(3) \ @@ -587,7 +635,10 @@ vtkDebugMacro(<< " returning " #name " = (" << _arg1 << "," << _arg2 << "," << _arg3 << ")"); \ } \ VTK_WRAPEXCLUDE \ - virtual void Get##name(type _arg[3]) { this->Get##name(_arg[0], _arg[1], _arg[2]); } + virtual void Get##name(type _arg[3]) \ + { \ + this->Get##name(_arg[0], _arg[1], _arg[2]); \ + } #define vtkSetVector4Macro(name, type) \ virtual void Set##name(type _arg1, type _arg2, type _arg3, type _arg4) \ @@ -645,7 +696,10 @@ << _arg4 << ")"); \ } \ VTK_WRAPEXCLUDE \ - virtual void Get##name(type _arg[4]) { this->Get##name(_arg[0], _arg[1], _arg[2], _arg[3]); } + virtual void Get##name(type _arg[4]) \ + { \ + this->Get##name(_arg[0], _arg[1], _arg[2], _arg[3]); \ + } #define vtkSetVector6Macro(name, type) \ virtual void Set##name(type _arg1, type _arg2, type _arg3, type _arg4, type _arg5, type _arg6) \ @@ -977,12 +1031,18 @@ VTK_ABI_NAMESPACE_END << "): returning " #name "Coordinate address " << this->name##Coordinate); \ return this->name##Coordinate; \ } \ - virtual void Set##name(double x[3]) { this->Set##name(x[0], x[1], x[2]); } \ + virtual void Set##name(double x[3]) \ + { \ + this->Set##name(x[0], x[1], x[2]); \ + } \ virtual void Set##name(double x, double y, double z) \ { \ this->name##Coordinate->SetValue(x, y, z); \ } \ - virtual double* Get##name() VTK_SIZEHINT(3) { return this->name##Coordinate->GetValue(); } + virtual double* Get##name() VTK_SIZEHINT(3) \ + { \ + return this->name##Coordinate->GetValue(); \ + } #define vtkViewportCoordinateMacro(name) \ virtual vtkCoordinate* Get##name##Coordinate() \ @@ -991,16 +1051,28 @@ VTK_ABI_NAMESPACE_END << "): returning " #name "Coordinate address " << this->name##Coordinate); \ return this->name##Coordinate; \ } \ - virtual void Set##name(double x[2]) { this->Set##name(x[0], x[1]); } \ - virtual void Set##name(double x, double y) { this->name##Coordinate->SetValue(x, y); } \ - virtual double* Get##name() VTK_SIZEHINT(2) { return this->name##Coordinate->GetValue(); } + virtual void Set##name(double x[2]) \ + { \ + this->Set##name(x[0], x[1]); \ + } \ + virtual void Set##name(double x, double y) \ + { \ + this->name##Coordinate->SetValue(x, y); \ + } \ + virtual double* Get##name() VTK_SIZEHINT(2) \ + { \ + return this->name##Coordinate->GetValue(); \ + } // Allows definition of vtkObject API such that NewInstance may return a // superclass of thisClass. #define vtkAbstractTypeMacroWithNewInstanceType( \ thisClass, superclass, instanceType, thisClassName) \ protected: \ - const char* GetClassNameInternal() const override { return thisClassName; } \ + const char* GetClassNameInternal() const override \ + { \ + return thisClassName; \ + } \ \ public: \ typedef superclass Superclass; \ @@ -1012,7 +1084,10 @@ public: } \ return superclass::IsTypeOf(type); \ } \ - vtkTypeBool IsA(const char* type) override { return this->thisClass::IsTypeOf(type); } \ + vtkTypeBool IsA(const char* type) override \ + { \ + return this->thisClass::IsTypeOf(type); \ + } \ static thisClass* SafeDownCast(vtkObjectBase* o) \ { \ if (o && o->IsA(thisClassName)) \ @@ -1050,7 +1125,10 @@ public: vtkAbstractTypeMacro(thisClass, superclass) \ \ protected: \ - vtkObjectBase* NewInstanceInternal() const override { return thisClass::New(); } \ + vtkObjectBase* NewInstanceInternal() const override \ + { \ + return thisClass::New(); \ + } \ \ public: @@ -1064,7 +1142,10 @@ public: vtkAbstractTypeMacro(thisClass, superclass) \ \ protected: \ - virtual vtkObjectBase* NewInstanceInternal() const { return thisClass::New(); } \ + virtual vtkObjectBase* NewInstanceInternal() const \ + { \ + return thisClass::New(); \ + } \ \ public: @@ -1091,7 +1172,10 @@ public: vtkAbstractTemplateTypeMacro(thisClass, superclass); \ \ protected: \ - vtkObjectBase* NewInstanceInternal() const override { return thisClass::New(); } \ + vtkObjectBase* NewInstanceInternal() const override \ + { \ + return thisClass::New(); \ + } \ \ public: diff --git a/Common/Core/vtkStringToken.cxx b/Common/Core/vtkStringToken.cxx index 83368b0463a..bc569f70385 100644 --- a/Common/Core/vtkStringToken.cxx +++ b/Common/Core/vtkStringToken.cxx @@ -80,7 +80,8 @@ std::unordered_set<vtkStringToken> vtkStringToken::Children(bool recursive) std::unordered_set<vtkStringToken> result; auto* manager = token_NAMESPACE::Token::getManager(); token_NAMESPACE::Manager::Visitor visitor = [&result, &manager, &visitor, recursive]( - token_NAMESPACE::Hash member) { + token_NAMESPACE::Hash member) + { if (recursive && result.find(member) == result.end()) { manager->visitMembers(visitor, member); @@ -96,7 +97,8 @@ std::unordered_set<vtkStringToken> vtkStringToken::AllGroups() { std::unordered_set<vtkStringToken> result; auto* manager = token_NAMESPACE::Token::getManager(); - token_NAMESPACE::Manager::Visitor visitor = [&result](token_NAMESPACE::Hash member) { + token_NAMESPACE::Manager::Visitor visitor = [&result](token_NAMESPACE::Hash member) + { result.insert(vtkStringToken(member)); return token_NAMESPACE::Manager::Visit::Continue; }; diff --git a/Common/Core/vtkThreadedCallbackQueue.cxx b/Common/Core/vtkThreadedCallbackQueue.cxx index b830f9bba71..8819b44a315 100644 --- a/Common/Core/vtkThreadedCallbackQueue.cxx +++ b/Common/Core/vtkThreadedCallbackQueue.cxx @@ -120,71 +120,75 @@ vtkThreadedCallbackQueue::~vtkThreadedCallbackQueue() //----------------------------------------------------------------------------- void vtkThreadedCallbackQueue::SetNumberOfThreads(int numberOfThreads) { - this->PushControl([this, numberOfThreads]() { - int size = static_cast<int>(this->Threads.size()); - - std::lock_guard<std::mutex> destroyLock(this->DestroyMutex); - if (this->Destroying) - { - return; - } - if (size == numberOfThreads) + this->PushControl( + [this, numberOfThreads]() { - // Nothing to do - return; - } - // If we are expanding the number of threads, then we just need to spawn - // the missing threads. - else if (size < numberOfThreads) - { - this->NumberOfThreads = numberOfThreads; + int size = static_cast<int>(this->Threads.size()); - std::generate_n(std::back_inserter(this->Threads), numberOfThreads - size, [this] { - auto threadIndex = - std::make_shared<std::atomic_int>(static_cast<int>(this->Threads.size())); - auto thread = std::thread(ThreadWorker(this, threadIndex)); - { - std::lock_guard<std::mutex> threadIdLock(this->ThreadIdToIndexMutex); - this->ThreadIdToIndex.emplace(thread.get_id(), threadIndex); - } - return thread; - }); - } - // If we are shrinking the number of threads, let's notify all threads - // so the threads whose id is more than the updated NumberOfThreads terminate. - else - { - // If we have a thread index larger than the new number of threads, we swap ourself with - // thread 0. We now know we will live after this routine and can synchronize terminating - // threads ourselves. + std::lock_guard<std::mutex> destroyLock(this->DestroyMutex); + if (this->Destroying) { - std::unique_lock<std::mutex> lock(this->ThreadIdToIndexMutex); - std::atomic_int& threadIndex = *this->ThreadIdToIndex.at(std::this_thread::get_id()); - if (threadIndex && threadIndex >= numberOfThreads) - { - std::atomic_int& thread0Index = *this->ThreadIdToIndex.at(this->Threads[0].get_id()); - lock.unlock(); - - std::swap(this->Threads[threadIndex], this->Threads[0]); - - // Swapping the value of atomic ThreadIndex inside ThreadWorker. - int tmp = thread0Index; - thread0Index.exchange(threadIndex); - threadIndex = tmp; - } + return; } - + if (size == numberOfThreads) + { + // Nothing to do + return; + } + // If we are expanding the number of threads, then we just need to spawn + // the missing threads. + else if (size < numberOfThreads) { - std::lock_guard<std::mutex> lock(this->Mutex); this->NumberOfThreads = numberOfThreads; + + std::generate_n(std::back_inserter(this->Threads), numberOfThreads - size, + [this] + { + auto threadIndex = + std::make_shared<std::atomic_int>(static_cast<int>(this->Threads.size())); + auto thread = std::thread(ThreadWorker(this, threadIndex)); + { + std::lock_guard<std::mutex> threadIdLock(this->ThreadIdToIndexMutex); + this->ThreadIdToIndex.emplace(thread.get_id(), threadIndex); + } + return thread; + }); } - this->ConditionVariable.notify_all(); - this->Sync(this->NumberOfThreads); + // If we are shrinking the number of threads, let's notify all threads + // so the threads whose id is more than the updated NumberOfThreads terminate. + else + { + // If we have a thread index larger than the new number of threads, we swap ourself with + // thread 0. We now know we will live after this routine and can synchronize terminating + // threads ourselves. + { + std::unique_lock<std::mutex> lock(this->ThreadIdToIndexMutex); + std::atomic_int& threadIndex = *this->ThreadIdToIndex.at(std::this_thread::get_id()); + if (threadIndex && threadIndex >= numberOfThreads) + { + std::atomic_int& thread0Index = *this->ThreadIdToIndex.at(this->Threads[0].get_id()); + lock.unlock(); + + std::swap(this->Threads[threadIndex], this->Threads[0]); + + // Swapping the value of atomic ThreadIndex inside ThreadWorker. + int tmp = thread0Index; + thread0Index.exchange(threadIndex); + threadIndex = tmp; + } + } - // Excess threads are done, we can resize - this->Threads.resize(numberOfThreads); - } - }); + { + std::lock_guard<std::mutex> lock(this->Mutex); + this->NumberOfThreads = numberOfThreads; + } + this->ConditionVariable.notify_all(); + this->Sync(this->NumberOfThreads); + + // Excess threads are done, we can resize + this->Threads.resize(numberOfThreads); + } + }); } //----------------------------------------------------------------------------- @@ -279,7 +283,8 @@ void vtkThreadedCallbackQueue::SignalDependentSharedFutures(vtkSharedFutureBase* //----------------------------------------------------------------------------- bool vtkThreadedCallbackQueue::TryInvoke(vtkSharedFutureBase* invoker) { - if (![this, &invoker] { + if (![this, &invoker] + { // We need to check again if we cannot run in case the thread worker just popped this // invoker. We are guarded by this->Mutex so there cannot be a conflict here. if (invoker->Status.load(std::memory_order_relaxed) != ENQUEUED) diff --git a/Common/Core/vtkThreadedCallbackQueue.txx b/Common/Core/vtkThreadedCallbackQueue.txx index 8f5a4414ae1..b212e0adb79 100644 --- a/Common/Core/vtkThreadedCallbackQueue.txx +++ b/Common/Core/vtkThreadedCallbackQueue.txx @@ -142,7 +142,7 @@ struct vtkThreadedCallbackQueue::InvokerImpl std::is_lvalue_reference<typename std::tuple_element<Is, FunctionArgsTupleT>::type>::value, typename std::decay<typename std::tuple_element<Is, FunctionArgsTupleT>::type>::type, typename std::decay<typename std::tuple_element<Is, InputArgsTupleT>::type>::type>::type...> - GetStaticCastArgsTuple(IntegerSequence<Is...>); + GetStaticCastArgsTuple(IntegerSequence<Is...>); /** * Convenient typedef to create a tuple of types allowing to call the constructor of the function @@ -605,7 +605,8 @@ void vtkThreadedCallbackQueue::PushControl(FT&& f, ArgsT&&... args) // We want the setting of ControlFutures to be strictly sequential. We don't want race conditions // on this container with 2 `PushControl` that are called almost simultaneously and have invokers // depend on flaky futures. - auto localControlFutures = [this, &invoker] { + auto localControlFutures = [this, &invoker] + { std::lock_guard<std::mutex> lock(this->ControlMutex); // We create a copy of the control futures that doesn't have ourselves in yet. diff --git a/Common/Core/vtkThreadedTaskQueue.txx b/Common/Core/vtkThreadedTaskQueue.txx index ed4e6a1f67e..5b37c2ef949 100644 --- a/Common/Core/vtkThreadedTaskQueue.txx +++ b/Common/Core/vtkThreadedTaskQueue.txx @@ -135,10 +135,12 @@ public: bool Pop(R& result) { std::unique_lock<std::mutex> lk(this->ResultsMutex); - this->ResultsCV.wait(lk, [this] { - return !this->Results.empty() && - (!this->StrictOrdering || this->Results.top().first == this->NextResultId); - }); + this->ResultsCV.wait(lk, + [this] + { + return !this->Results.empty() && + (!this->StrictOrdering || this->Results.top().first == this->NextResultId); + }); lk.unlock(); return this->TryPop(result); } @@ -174,7 +176,8 @@ vtkThreadedTaskQueue<R, Args...>::vtkThreadedTaskQueue( : max_concurrent_tasks) , Threads{ new std::thread[this->NumberOfThreads] } { - auto f = [this](int thread_id) { + auto f = [this](int thread_id) + { vtkLogger::SetThreadName("ttq::worker" + std::to_string(thread_id)); while (true) { @@ -270,7 +273,8 @@ vtkThreadedTaskQueue<void, Args...>::vtkThreadedTaskQueue(std::function<void(Arg : max_concurrent_tasks) , Threads{ new std::thread[this->NumberOfThreads] } { - auto f = [this](int thread_id) { + auto f = [this](int thread_id) + { vtkLogger::SetThreadName("ttq::worker" + std::to_string(thread_id)); while (true) { diff --git a/Common/Core/vtkTypeTraits.h b/Common/Core/vtkTypeTraits.h index 15e606d4a19..3fe6bc9bec4 100644 --- a/Common/Core/vtkTypeTraits.h +++ b/Common/Core/vtkTypeTraits.h @@ -32,31 +32,52 @@ struct vtkTypeTraits; { \ VTK_TYPE_ID = VTK_##macro \ }; \ - static int VTKTypeID() { return VTK_##macro; } \ + static int VTKTypeID() \ + { \ + return VTK_##macro; \ + } \ \ /* The smallest possible value represented by the type. */ \ - static type Min() { return VTK_##macro##_MIN; } \ + static type Min() \ + { \ + return VTK_##macro##_MIN; \ + } \ \ /* The largest possible value represented by the type. */ \ - static type Max() { return VTK_##macro##_MAX; } \ + static type Max() \ + { \ + return VTK_##macro##_MAX; \ + } \ \ /* Whether the type is signed. */ \ - static int IsSigned() { return isSigned; } \ + static int IsSigned() \ + { \ + return isSigned; \ + } \ \ /* An "alias" type that is the same size and signedness. */ \ typedef vtkType##name SizedType; \ \ /* A name for the type indicating its size and signedness. */ \ - static const char* SizedName() { return #name; } \ + static const char* SizedName() \ + { \ + return #name; \ + } \ \ /* The common C++ name for the type (e.g. float, unsigned int, etc).*/ \ - static const char* Name() { return #type; } \ + static const char* Name() \ + { \ + return #type; \ + } \ \ /* A type to use for printing or parsing values in strings. */ \ typedef print PrintType; \ \ /* A format for parsing values from strings. Use with PrintType. */ \ - static const char* ParseFormat() { return format; } \ + static const char* ParseFormat() \ + { \ + return format; \ + } \ } // Define traits for floating-point types. diff --git a/Common/Core/vtkValueFromString.cxx b/Common/Core/vtkValueFromString.cxx index cf291be9380..eea9d8f6f61 100644 --- a/Common/Core/vtkValueFromString.cxx +++ b/Common/Core/vtkValueFromString.cxx @@ -133,7 +133,8 @@ const char* ParseInt(const char* it, const char* end, bool minus_sign, int base, constexpr UnsignedType absimin = static_cast<UnsignedType>(1) << ((sizeof(UnsignedType) * CHAR_BIT) - 1); - const auto limit = [=]() { + const auto limit = [=]() + { if (std::is_signed<T>::value) { if (minus_sign) diff --git a/Common/Core/vtkVariant.cxx b/Common/Core/vtkVariant.cxx index bf94a9eaa24..6a7639428f6 100644 --- a/Common/Core/vtkVariant.cxx +++ b/Common/Core/vtkVariant.cxx @@ -821,7 +821,8 @@ T vtkVariantStringToNumeric(const vtkStdString& str, bool* valid, T* vtkNotUsed( auto it = str.data(); const auto end = str.data() + str.size(); - const auto consumeWhitespaces = [&it, end]() { + const auto consumeWhitespaces = [&it, end]() + { it = std::find_if(it, end, [](char c) { return !std::isspace(static_cast<unsigned char>(c)); }); }; diff --git a/Common/Core/vtkVariant.h b/Common/Core/vtkVariant.h index ffe105e3521..58a705b238e 100644 --- a/Common/Core/vtkVariant.h +++ b/Common/Core/vtkVariant.h @@ -399,7 +399,8 @@ private: template <typename T> T ToNumeric(bool* valid, T* vtkNotUsed(ignored)) const; - union { + union + { vtkStdString* String; float Float; double Double; diff --git a/Common/Core/vtkVersion.cxx b/Common/Core/vtkVersion.cxx index 872b19c200c..a6eb0e99ae7 100644 --- a/Common/Core/vtkVersion.cxx +++ b/Common/Core/vtkVersion.cxx @@ -23,5 +23,8 @@ VTK_ABI_NAMESPACE_END extern "C" { - const char* VTK_ABI_NAMESPACE_MANGLE(GetVTKVersion)() { return vtkVersion::GetVTKVersion(); } + const char* VTK_ABI_NAMESPACE_MANGLE(GetVTKVersion)() + { + return vtkVersion::GetVTKVersion(); + } } diff --git a/Common/DataModel/Testing/Cxx/TestCellArray.cxx b/Common/DataModel/Testing/Cxx/TestCellArray.cxx index dad2cd86d89..a95ad620690 100644 --- a/Common/DataModel/Testing/Cxx/TestCellArray.cxx +++ b/Common/DataModel/Testing/Cxx/TestCellArray.cxx @@ -164,7 +164,8 @@ void TestSqueeze(vtkSmartPointer<vtkCellArray> cellArray) TEST_ASSERT(cellArray->GetOffsetsArray()->GetSize() == 4); TEST_ASSERT(cellArray->GetConnectivityArray()->GetSize() == 8); - auto validate = [&](const vtkIdType cellId, const std::initializer_list<vtkIdType>& ref) { + auto validate = [&](const vtkIdType cellId, const std::initializer_list<vtkIdType>& ref) + { vtkIdType npts; const vtkIdType* pts; cellArray->GetCellAtId(cellId, npts, pts); @@ -613,7 +614,8 @@ void TestTraversalSizePointer(vtkSmartPointer<vtkCellArray> cellArray) cellArray->InsertNextCell({ 4, 5 }); cellArray->InsertNextCell({ 9, 4, 5, 1 }); - auto validate = [&](const std::initializer_list<vtkIdType>& ref) { + auto validate = [&](const std::initializer_list<vtkIdType>& ref) + { vtkIdType npts; const vtkIdType* pts; TEST_ASSERT(cellArray->GetNextCell(npts, pts) != 0); @@ -648,7 +650,8 @@ void TestTraversalIdList(vtkSmartPointer<vtkCellArray> cellArray) cellArray->InsertNextCell({ 4, 5 }); cellArray->InsertNextCell({ 9, 4, 5, 1 }); - auto validate = [&](const std::initializer_list<vtkIdType>& ref) { + auto validate = [&](const std::initializer_list<vtkIdType>& ref) + { vtkNew<vtkIdList> ids; TEST_ASSERT(cellArray->GetNextCell(ids) != 0); TEST_ASSERT(ref.size() == static_cast<std::size_t>(ids->GetNumberOfIds())); @@ -672,7 +675,8 @@ void TestGetCellAtId(vtkSmartPointer<vtkCellArray> cellArray) cellArray->InsertNextCell({ 4, 5 }); cellArray->InsertNextCell({ 9, 4, 5, 1 }); - auto validate = [&](const vtkIdType cellId, const std::initializer_list<vtkIdType>& ref) { + auto validate = [&](const vtkIdType cellId, const std::initializer_list<vtkIdType>& ref) + { vtkIdType npts; const vtkIdType* pts; cellArray->GetCellAtId(cellId, npts, pts); @@ -739,7 +743,8 @@ void TestInsertNextCell(vtkSmartPointer<vtkCellArray> cellArray) TEST_ASSERT(cellArray->InsertNextCell({ 0, 1 }) == 3); TEST_ASSERT(cellArray->GetNumberOfCells() == 4); - auto validate = [&](const vtkIdType cellId, const std::initializer_list<vtkIdType>& ref) { + auto validate = [&](const vtkIdType cellId, const std::initializer_list<vtkIdType>& ref) + { vtkIdType npts; const vtkIdType* pts; cellArray->GetCellAtId(cellId, npts, pts); @@ -774,7 +779,8 @@ void TestIncrementalCellInsertion(vtkSmartPointer<vtkCellArray> cellArray) cellArray->InsertCellPoint(1); cellArray->InsertCellPoint(5); - auto validate = [&](const vtkIdType cellId, const std::initializer_list<vtkIdType>& ref) { + auto validate = [&](const vtkIdType cellId, const std::initializer_list<vtkIdType>& ref) + { vtkIdType npts; const vtkIdType* pts; cellArray->GetCellAtId(cellId, npts, pts); @@ -797,7 +803,8 @@ void TestReverseCellAtId(vtkSmartPointer<vtkCellArray> cellArray) cellArray->InsertNextCell({ 7, 8, 9, 1 }); cellArray->InsertNextCell({ 5, 3, 4 }); - auto validate = [&](const vtkIdType cellId, const std::initializer_list<vtkIdType>& ref) { + auto validate = [&](const vtkIdType cellId, const std::initializer_list<vtkIdType>& ref) + { vtkIdType npts; const vtkIdType* pts; cellArray->GetCellAtId(cellId, npts, pts); @@ -834,7 +841,8 @@ void TestReplaceCellAtId(vtkSmartPointer<vtkCellArray> cellArray) cellArray->InsertNextCell({ 7, 8, 9, 1 }); cellArray->InsertNextCell({ 5, 3, 4 }); - auto validate = [&](const vtkIdType cellId, const std::initializer_list<vtkIdType>& ref) { + auto validate = [&](const vtkIdType cellId, const std::initializer_list<vtkIdType>& ref) + { vtkIdType npts; const vtkIdType* pts; cellArray->GetCellAtId(cellId, npts, pts); @@ -949,7 +957,8 @@ void TestAppendImpl(vtkSmartPointer<vtkCellArray> first, vtkSmartPointer<vtkCell concat->Append(second, 10); // add 10 to all point ids from second TEST_ASSERT(concat->GetNumberOfCells() == 6); - auto validate = [&](const vtkIdType cellId, const std::initializer_list<vtkIdType>& ref) { + auto validate = [&](const vtkIdType cellId, const std::initializer_list<vtkIdType>& ref) + { vtkIdType npts; const vtkIdType* pts; concat->GetCellAtId(cellId, npts, pts); @@ -999,7 +1008,8 @@ void TestLegacyFormatImportExportAppend(vtkSmartPointer<vtkCellArray> cellArray) cellArray->Initialize(); cellArray->ImportLegacyFormat(legacy); - auto validate = [&](const vtkIdType cellId, const std::initializer_list<vtkIdType>& ref) { + auto validate = [&](const vtkIdType cellId, const std::initializer_list<vtkIdType>& ref) + { vtkIdType npts; const vtkIdType* pts; cellArray->GetCellAtId(cellId, npts, pts); @@ -1116,7 +1126,8 @@ void TestLegacyGetCell(vtkSmartPointer<vtkCellArray> cellArray) cellArray->InsertNextCell({ 3, 4 }); cellArray->InsertNextCell({ 5, 6, 7 }); - auto validate = [&](const vtkIdType loc, const std::initializer_list<vtkIdType>& ref) { + auto validate = [&](const vtkIdType loc, const std::initializer_list<vtkIdType>& ref) + { vtkIdType npts; const vtkIdType* pts; cellArray->GetCell(loc, npts, pts); @@ -1185,7 +1196,8 @@ void TestLegacyReverseCell(vtkSmartPointer<vtkCellArray> cellArray) cellArray->InsertNextCell({ 7, 8, 9, 1 }); cellArray->InsertNextCell({ 5, 3, 4 }); - auto validate = [&](const vtkIdType cellId, const std::initializer_list<vtkIdType>& ref) { + auto validate = [&](const vtkIdType cellId, const std::initializer_list<vtkIdType>& ref) + { vtkIdType npts; const vtkIdType* pts; cellArray->GetCellAtId(cellId, npts, pts); @@ -1222,7 +1234,8 @@ void TestLegacyReplaceCell(vtkSmartPointer<vtkCellArray> cellArray) cellArray->InsertNextCell({ 7, 8, 9, 1 }); cellArray->InsertNextCell({ 5, 3, 4 }); - auto validate = [&](const vtkIdType cellId, const std::initializer_list<vtkIdType>& ref) { + auto validate = [&](const vtkIdType cellId, const std::initializer_list<vtkIdType>& ref) + { vtkIdType npts; const vtkIdType* pts; cellArray->GetCellAtId(cellId, npts, pts); @@ -1318,7 +1331,8 @@ void TestLegacySetCells(vtkSmartPointer<vtkCellArray> cellArray) cellArray->SetCells(3, legacy); - auto validate = [&](const vtkIdType cellId, const std::initializer_list<vtkIdType>& ref) { + auto validate = [&](const vtkIdType cellId, const std::initializer_list<vtkIdType>& ref) + { vtkIdType npts; const vtkIdType* pts; cellArray->GetCellAtId(cellId, npts, pts); diff --git a/Common/DataModel/Testing/Cxx/TestCellIterators.cxx b/Common/DataModel/Testing/Cxx/TestCellIterators.cxx index 526342f3e65..d86e3c6a43b 100644 --- a/Common/DataModel/Testing/Cxx/TestCellIterators.cxx +++ b/Common/DataModel/Testing/Cxx/TestCellIterators.cxx @@ -20,11 +20,11 @@ // Enable/disable code that helps/hinders profiling. #undef PROFILE -//#define PROFILE +// #define PROFILE // Enable benchmarks. #undef BENCHMARK -//#define BENCHMARK +// #define BENCHMARK #ifdef BENCHMARK #ifdef PROFILE diff --git a/Common/DataModel/Testing/Cxx/TestCompositeDataSetRange.cxx b/Common/DataModel/Testing/Cxx/TestCompositeDataSetRange.cxx index 133a5ed5e3c..4267aecfd45 100644 --- a/Common/DataModel/Testing/Cxx/TestCompositeDataSetRange.cxx +++ b/Common/DataModel/Testing/Cxx/TestCompositeDataSetRange.cxx @@ -223,22 +223,23 @@ bool TestOptions(vtkCompositeDataSet* cds) vtkSmartPointer<vtkCompositeDataSet> CreateDataSet() { auto addPolyData = [](unsigned int blockNum, - vtkMultiBlockDataSet* mbds) -> vtkSmartPointer<vtkPolyData> { + vtkMultiBlockDataSet* mbds) -> vtkSmartPointer<vtkPolyData> + { vtkNew<vtkPolyData> pd; mbds->SetBlock(blockNum, pd); return { pd }; }; auto addMultiBlock = [](unsigned int blockNum, - vtkMultiBlockDataSet* mbds) -> vtkSmartPointer<vtkMultiBlockDataSet> { + vtkMultiBlockDataSet* mbds) -> vtkSmartPointer<vtkMultiBlockDataSet> + { auto newMbds = vtkSmartPointer<vtkMultiBlockDataSet>::New(); mbds->SetBlock(blockNum, newMbds); return newMbds; }; - auto addNullDataSet = [](unsigned int blockNum, vtkMultiBlockDataSet* mbds) -> void { - mbds->SetBlock(blockNum, nullptr); - }; + auto addNullDataSet = [](unsigned int blockNum, vtkMultiBlockDataSet* mbds) -> void + { mbds->SetBlock(blockNum, nullptr); }; auto cds00 = vtkSmartPointer<vtkMultiBlockDataSet>::New(); cds00->SetNumberOfBlocks(4); diff --git a/Common/DataModel/Testing/Cxx/TestDataAssemblyUtilities.cxx b/Common/DataModel/Testing/Cxx/TestDataAssemblyUtilities.cxx index e693bf3be74..475e53c72b0 100644 --- a/Common/DataModel/Testing/Cxx/TestDataAssemblyUtilities.cxx +++ b/Common/DataModel/Testing/Cxx/TestDataAssemblyUtilities.cxx @@ -127,7 +127,8 @@ vtkSmartPointer<vtkMultiBlockDataSet> CreateMultiBlock( const std::map<std::string, std::vector<std::string>>& map, int numPieces = 0) { std::function<vtkSmartPointer<vtkDataObject>(const std::string&)> populate; - populate = [&](const std::string& name) -> vtkSmartPointer<vtkDataObject> { + populate = [&](const std::string& name) -> vtkSmartPointer<vtkDataObject> + { auto iter = map.find(name); if (iter == map.end()) { @@ -177,7 +178,8 @@ bool TestMultiBlockDataSet(int numPieces) } hierarchy->Print(cout); - auto XPath = [&hierarchy](const std::string& path) { + auto XPath = [&hierarchy](const std::string& path) + { auto nodes = hierarchy->SelectNodes({ path }); return nodes.size() == 1 ? nodes[0] : -1; }; diff --git a/Common/DataModel/Testing/Cxx/TestDataObjectTreeRange.cxx b/Common/DataModel/Testing/Cxx/TestDataObjectTreeRange.cxx index 6e486dc22fa..1fa1c67b624 100644 --- a/Common/DataModel/Testing/Cxx/TestDataObjectTreeRange.cxx +++ b/Common/DataModel/Testing/Cxx/TestDataObjectTreeRange.cxx @@ -237,22 +237,23 @@ bool TestOptions(vtkDataObjectTree* cds) vtkSmartPointer<vtkDataObjectTree> CreateDataSet() { auto addPolyData = [](unsigned int blockNum, - vtkMultiBlockDataSet* mbds) -> vtkSmartPointer<vtkPolyData> { + vtkMultiBlockDataSet* mbds) -> vtkSmartPointer<vtkPolyData> + { vtkNew<vtkPolyData> pd; mbds->SetBlock(blockNum, pd); return { pd }; }; auto addMultiBlock = [](unsigned int blockNum, - vtkMultiBlockDataSet* mbds) -> vtkSmartPointer<vtkMultiBlockDataSet> { + vtkMultiBlockDataSet* mbds) -> vtkSmartPointer<vtkMultiBlockDataSet> + { auto newMbds = vtkSmartPointer<vtkMultiBlockDataSet>::New(); mbds->SetBlock(blockNum, newMbds); return newMbds; }; - auto addNullDataSet = [](unsigned int blockNum, vtkMultiBlockDataSet* mbds) -> void { - mbds->SetBlock(blockNum, nullptr); - }; + auto addNullDataSet = [](unsigned int blockNum, vtkMultiBlockDataSet* mbds) -> void + { mbds->SetBlock(blockNum, nullptr); }; auto cds00 = vtkSmartPointer<vtkMultiBlockDataSet>::New(); cds00->SetNumberOfBlocks(4); diff --git a/Common/DataModel/Testing/Cxx/TestDataSetAttributes.cxx b/Common/DataModel/Testing/Cxx/TestDataSetAttributes.cxx index 2be6890dbc8..f52ff73a48c 100644 --- a/Common/DataModel/Testing/Cxx/TestDataSetAttributes.cxx +++ b/Common/DataModel/Testing/Cxx/TestDataSetAttributes.cxx @@ -16,7 +16,8 @@ int TestDataSetAttributes(int, char*[]) const int EXTENT[] = { 0, EXT - 1, 0, EXT - 1, 0, EXT - 1 }; constexpr int GHOST_INDICES[] = { 3, 15, 30, 40, -1 }; - auto makeGhostArray = [&](unsigned char ghostType) { + auto makeGhostArray = [&](unsigned char ghostType) + { vtkNew<vtkUnsignedCharArray> ghosts; ghosts->SetName(vtkDataSetAttributes::GhostArrayName()); ghosts->SetNumberOfValues(N); @@ -30,7 +31,8 @@ int TestDataSetAttributes(int, char*[]) return ghosts; }; - auto makeFD = [&](unsigned char ghostType) { + auto makeFD = [&](unsigned char ghostType) + { vtkNew<vtkDataSetAttributes> fd; fd->AddArray(makeGhostArray(ghostType)); return fd; @@ -44,7 +46,8 @@ int TestDataSetAttributes(int, char*[]) vtkNew<vtkDataSetAttributes> destPD, destCD; auto testCopyStructuredData = [&](vtkDataSetAttributes* from, vtkDataSetAttributes* to, - vtkDataSetAttributes* ref, unsigned char ghostType) { + vtkDataSetAttributes* ref, unsigned char ghostType) + { to->CopyAllocate(ref); // Copying multiple arrays sharing ghosts should have DUPLICATEPOINT or DUPLICATECELL // disappear from the output (bit is turned OFF by ref) diff --git a/Common/DataModel/Testing/Cxx/TestHigherOrderCell.cxx b/Common/DataModel/Testing/Cxx/TestHigherOrderCell.cxx index b36dc1cb437..827873b7e4e 100644 --- a/Common/DataModel/Testing/Cxx/TestHigherOrderCell.cxx +++ b/Common/DataModel/Testing/Cxx/TestHigherOrderCell.cxx @@ -86,7 +86,8 @@ int TestHigherOrderCell(int, char*[]) return 1; } - auto isQuadraticWedge = [](int cellType) -> bool { + auto isQuadraticWedge = [](int cellType) -> bool + { return (cellType == VTK_QUADRATIC_LINEAR_WEDGE) || (cellType == VTK_BIQUADRATIC_QUADRATIC_WEDGE) || (cellType == VTK_QUADRATIC_WEDGE); }; diff --git a/Common/DataModel/Testing/Cxx/TestHyperTreeGridGeometricLocator.cxx b/Common/DataModel/Testing/Cxx/TestHyperTreeGridGeometricLocator.cxx index 1263822b3df..6758dcd5c0c 100644 --- a/Common/DataModel/Testing/Cxx/TestHyperTreeGridGeometricLocator.cxx +++ b/Common/DataModel/Testing/Cxx/TestHyperTreeGridGeometricLocator.cxx @@ -52,9 +52,8 @@ bool runOutsidePointSearch(vtkHyperTreeGridGeometricLocator* htgLoc, TestResults bool runOuterEdgeSearch(vtkHyperTreeGridGeometricLocator* htgLoc, TestResults* theseResults) { - auto getLastComponent = [](vtkDataArray* thisArray) { - return thisArray->GetComponent(thisArray->GetNumberOfTuples() - 1, 0); - }; + auto getLastComponent = [](vtkDataArray* thisArray) + { return thisArray->GetComponent(thisArray->GetNumberOfTuples() - 1, 0); }; double pt[3]{ getLastComponent(htgLoc->GetHTG()->GetXCoordinates()), getLastComponent(htgLoc->GetHTG()->GetYCoordinates()), getLastComponent(htgLoc->GetHTG()->GetZCoordinates()) }; @@ -113,7 +112,8 @@ bool runAllMaskedPointSearch( vtkIdType globIdSecond = 0; if (success) { - auto setChildrenMask = [&htgLoc, &cursorFirst](bool state) { + auto setChildrenMask = [&htgLoc, &cursorFirst](bool state) + { for (unsigned int d = 0; d < htgLoc->GetHTG()->GetNumberOfChildren(); d++) { cursorFirst->ToChild(d); @@ -194,7 +194,8 @@ bool runIntersectDiagonal(vtkHyperTreeGridGeometricLocator* htgLoc, TestResults* std::vector<double> origin(3, 0.0); std::vector<double> diagPt(3, 0.0); unsigned int dim = htgLoc->GetHTG()->GetDimension(); - auto getDiagonalComponents = [](vtkDataArray* compArray, double& first, double& last) { + auto getDiagonalComponents = [](vtkDataArray* compArray, double& first, double& last) + { first = compArray->GetComponent(0, 0); last = compArray->GetComponent(compArray->GetNumberOfTuples() - 1, 0); }; @@ -274,7 +275,8 @@ bool runIntersectWithMaskDiagonal( std::vector<double> origin(3, 0.0); std::vector<double> diagPt(3, 0.0); unsigned int dim = htgLoc->GetHTG()->GetDimension(); - auto getDiagonalComponents = [](vtkDataArray* compArray, double& first, double& last) { + auto getDiagonalComponents = [](vtkDataArray* compArray, double& first, double& last) + { first = compArray->GetComponent(0, 0); last = compArray->GetComponent(compArray->GetNumberOfTuples() - 1, 0); }; @@ -315,7 +317,8 @@ bool runAllIntersectsDiagonal(vtkHyperTreeGridGeometricLocator* htgLoc, TestResu std::vector<double> origin(3, 0.0); std::vector<double> diagPt(3, 0.0); unsigned int dim = htgLoc->GetHTG()->GetDimension(); - auto getDiagonalComponents = [](vtkDataArray* compArray, double& first, double& last) { + auto getDiagonalComponents = [](vtkDataArray* compArray, double& first, double& last) + { first = compArray->GetComponent(0, 0); last = compArray->GetComponent(compArray->GetNumberOfTuples() - 1, 0); }; @@ -420,7 +423,8 @@ bool TestLocatorTolerance() bool success = true; // Testing vtkHyperTreeGridGeometricLocator::Search - auto TestSearchPoint = [&locator](std::array<double, 3> point, vtkIdType expected) { + auto TestSearchPoint = [&locator](std::array<double, 3> point, vtkIdType expected) + { bool pointSuccess = true; vtkIdType cellId = locator->Search(point.data()); if (cellId != expected) diff --git a/Common/DataModel/Testing/Cxx/TestInterpolationDerivs.cxx b/Common/DataModel/Testing/Cxx/TestInterpolationDerivs.cxx index 5c16061069b..0f5aa7966f2 100644 --- a/Common/DataModel/Testing/Cxx/TestInterpolationDerivs.cxx +++ b/Common/DataModel/Testing/Cxx/TestInterpolationDerivs.cxx @@ -4,20 +4,20 @@ #define VTK_EPSILON 1e-10 // Subclass of vtkCell -//#include "vtkEmptyCell.h" +// #include "vtkEmptyCell.h" #include "vtkGenericCell.h" #include "vtkLine.h" #include "vtkPixel.h" -//#include "vtkPolygon.h" -//#include "vtkPolyLine.h" -//#include "vtkPolyVertex.h" +// #include "vtkPolygon.h" +// #include "vtkPolyLine.h" +// #include "vtkPolyVertex.h" #include "vtkQuad.h" #include "vtkTriangle.h" -//#include "vtkTriangleStrip.h" +// #include "vtkTriangleStrip.h" #include "vtkVertex.h" // Subclass of vtkCell3D -//#include "vtkConvexPointSet.h" +// #include "vtkConvexPointSet.h" #include "vtkHexagonalPrism.h" #include "vtkHexahedron.h" #include "vtkPentagonalPrism.h" diff --git a/Common/DataModel/Testing/Cxx/TestSMPFeatures.cxx b/Common/DataModel/Testing/Cxx/TestSMPFeatures.cxx index 7bced70ac5c..12d815cbe95 100644 --- a/Common/DataModel/Testing/Cxx/TestSMPFeatures.cxx +++ b/Common/DataModel/Testing/Cxx/TestSMPFeatures.cxx @@ -179,23 +179,25 @@ int TestSMPFeatures(int, char*[]) planes[15] = 0; planes[19] = 0; planes[23] = 0; - vtkSMPTools::For(0, numPts, [&](vtkIdType ptId, vtkIdType endPtId) { - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, numPts, + [&](vtkIdType ptId, vtkIdType endPtId) { - double v, coord[3]; - pts->GetPoint(ptId, coord); - for (auto j = 0; j < numPlanes; j++) + for (; ptId < endPtId; ++ptId) { - v = -(planes[j * 4 + 0] * coord[0] + planes[j * 4 + 1] * coord[1] + - planes[j * 4 + 2] * coord[2]); - // negative means further in + direction of plane - if (v < planes[j * 4 + 3]) + double v, coord[3]; + pts->GetPoint(ptId, coord); + for (auto j = 0; j < numPlanes; j++) { - planes[j * 4 + 3] = v; + v = -(planes[j * 4 + 0] * coord[0] + planes[j * 4 + 1] * coord[1] + + planes[j * 4 + 2] * coord[2]); + // negative means further in + direction of plane + if (v < planes[j * 4 + 3]) + { + planes[j * 4 + 3] = v; + } } } - } - }); // end lambda + }); // end lambda std::cout << "Planes (lambda): " << planes[3] << ", " << planes[7] << ", " << planes[11] << ", " << planes[15] << ", " << planes[19] << ", " << planes[23] << "\n"; diff --git a/Common/DataModel/Testing/Cxx/TestSelectionExpression.cxx b/Common/DataModel/Testing/Cxx/TestSelectionExpression.cxx index b81881027c0..01f6b29646b 100644 --- a/Common/DataModel/Testing/Cxx/TestSelectionExpression.cxx +++ b/Common/DataModel/Testing/Cxx/TestSelectionExpression.cxx @@ -107,42 +107,50 @@ int TestSelectionExpression(int, char*[]) arrays_ptrs[cc] = newarray; } - Validate(expr, "A & (B | (C & D))", arrays_ptrs, [&](vtkIdType cc) { - auto a = get(arrays["A"], cc); - auto b = get(arrays["B"], cc); - auto c = get(arrays["C"], cc); - auto d = get(arrays["D"], cc); - return a && (b || (c && d)); - }); - - Validate(expr, "A & B | (C & D)", arrays_ptrs, [&](vtkIdType cc) { - auto a = get(arrays["A"], cc); - auto b = get(arrays["B"], cc); - auto c = get(arrays["C"], cc); - auto d = get(arrays["D"], cc); - return (a && b) || (c && d); - }); - - Validate(expr, "(A & B) | (C | (D & E) ) | (C & D)", arrays_ptrs, [&](vtkIdType cc) { - auto a = get(arrays["A"], cc); - auto b = get(arrays["B"], cc); - auto c = get(arrays["C"], cc); - auto d = get(arrays["D"], cc); - auto e = get(arrays["E"], cc); - return (a && b) || (c || (d && e)) || (c && d); - }); + Validate(expr, "A & (B | (C & D))", arrays_ptrs, + [&](vtkIdType cc) + { + auto a = get(arrays["A"], cc); + auto b = get(arrays["B"], cc); + auto c = get(arrays["C"], cc); + auto d = get(arrays["D"], cc); + return a && (b || (c && d)); + }); + + Validate(expr, "A & B | (C & D)", arrays_ptrs, + [&](vtkIdType cc) + { + auto a = get(arrays["A"], cc); + auto b = get(arrays["B"], cc); + auto c = get(arrays["C"], cc); + auto d = get(arrays["D"], cc); + return (a && b) || (c && d); + }); + + Validate(expr, "(A & B) | (C | (D & E) ) | (C & D)", arrays_ptrs, + [&](vtkIdType cc) + { + auto a = get(arrays["A"], cc); + auto b = get(arrays["B"], cc); + auto c = get(arrays["C"], cc); + auto d = get(arrays["D"], cc); + auto e = get(arrays["E"], cc); + return (a && b) || (c || (d && e)) || (c && d); + }); // empty expression is treated as "|" - Validate(expr, "", arrays, [&](vtkIdType cc) { - auto a = get(arrays["A"], cc); - auto b = get(arrays["B"], cc); - auto c = get(arrays["C"], cc); - auto d = get(arrays["D"], cc); - auto e = get(arrays["E"], cc); - auto f = get(arrays["F"], cc); - auto g = get(arrays["G"], cc); - return (a || b || c || d || e || f || g); - }); + Validate(expr, "", arrays, + [&](vtkIdType cc) + { + auto a = get(arrays["A"], cc); + auto b = get(arrays["B"], cc); + auto c = get(arrays["C"], cc); + auto d = get(arrays["D"], cc); + auto e = get(arrays["E"], cc); + auto f = get(arrays["F"], cc); + auto g = get(arrays["G"], cc); + return (a || b || c || d || e || f || g); + }); return EXIT_SUCCESS; } diff --git a/Common/DataModel/Testing/Cxx/TestSmoothErrorMetric.cxx b/Common/DataModel/Testing/Cxx/TestSmoothErrorMetric.cxx index d4ba4fc948d..a936458f19f 100644 --- a/Common/DataModel/Testing/Cxx/TestSmoothErrorMetric.cxx +++ b/Common/DataModel/Testing/Cxx/TestSmoothErrorMetric.cxx @@ -9,7 +9,7 @@ // not allow interaction and exit // -D <path> => path to the data; the data should be in <path>/Data/ -//#define WRITE_GENERIC_RESULT +// #define WRITE_GENERIC_RESULT #include "vtkActor.h" #include "vtkBridgeDataSet.h" diff --git a/Common/DataModel/vtkAbstractCellLocator.cxx b/Common/DataModel/vtkAbstractCellLocator.cxx index ee4c5575ad8..93c89be42a8 100644 --- a/Common/DataModel/vtkAbstractCellLocator.cxx +++ b/Common/DataModel/vtkAbstractCellLocator.cxx @@ -52,12 +52,14 @@ bool vtkAbstractCellLocator::StoreCellBounds() // side effects from GetCellBounds(). this->DataSet->GetCellBounds(0, &this->CellBounds[0]); - vtkSMPTools::For(1, numCells, [&](vtkIdType begin, vtkIdType end) { - for (vtkIdType cellId = begin; cellId < end; cellId++) + vtkSMPTools::For(1, numCells, + [&](vtkIdType begin, vtkIdType end) { - this->DataSet->GetCellBounds(cellId, &this->CellBounds[cellId * 6]); - } - }); + for (vtkIdType cellId = begin; cellId < end; cellId++) + { + this->DataSet->GetCellBounds(cellId, &this->CellBounds[cellId * 6]); + } + }); return true; } diff --git a/Common/DataModel/vtkBezierHexahedron.cxx b/Common/DataModel/vtkBezierHexahedron.cxx index d9471bb9150..d82251c13a5 100644 --- a/Common/DataModel/vtkBezierHexahedron.cxx +++ b/Common/DataModel/vtkBezierHexahedron.cxx @@ -36,12 +36,14 @@ vtkCell* vtkBezierHexahedron::GetEdge(int edgeId) if (this->GetRationalWeights()->GetNumberOfTuples() > 0) { - const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); result->GetRationalWeights()->SetNumberOfTuples(npts); }; - const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& vol_id) -> void { + const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& vol_id) -> void + { result->Points->SetPoint(edge_id, this->Points->GetPoint(vol_id)); result->PointIds->SetId(edge_id, this->PointIds->GetId(vol_id)); result->GetRationalWeights()->SetValue(edge_id, this->GetRationalWeights()->GetValue(vol_id)); @@ -50,12 +52,14 @@ vtkCell* vtkBezierHexahedron::GetEdge(int edgeId) } else { - const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); result->GetRationalWeights()->Reset(); }; - const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& vol_id) -> void { + const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& vol_id) -> void + { result->Points->SetPoint(edge_id, this->Points->GetPoint(vol_id)); result->PointIds->SetId(edge_id, this->PointIds->GetId(vol_id)); }; @@ -71,12 +75,14 @@ vtkCell* vtkBezierHexahedron::GetFace(int faceId) int faceOrder[2]; if (this->GetRationalWeights()->GetNumberOfTuples() > 0) { - const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); result->GetRationalWeights()->SetNumberOfTuples(npts); }; - const auto set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void { + const auto set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void + { result->Points->SetPoint(face_id, this->Points->GetPoint(vol_id)); result->PointIds->SetId(face_id, this->PointIds->GetId(vol_id)); result->GetRationalWeights()->SetValue(face_id, this->GetRationalWeights()->GetValue(vol_id)); @@ -86,12 +92,14 @@ vtkCell* vtkBezierHexahedron::GetFace(int faceId) } else { - const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); result->GetRationalWeights()->Reset(); }; - const auto set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void { + const auto set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void + { result->Points->SetPoint(face_id, this->Points->GetPoint(vol_id)); result->PointIds->SetId(face_id, this->PointIds->GetId(vol_id)); }; diff --git a/Common/DataModel/vtkBezierInterpolation.cxx b/Common/DataModel/vtkBezierInterpolation.cxx index 473d1bfdad4..9f84bfce619 100644 --- a/Common/DataModel/vtkBezierInterpolation.cxx +++ b/Common/DataModel/vtkBezierInterpolation.cxx @@ -195,15 +195,20 @@ void vtkBezierInterpolation::DeCasteljauSimplex( { const int sub_degree = d - 1; const int sub_degree_length = NumberOfSimplexFunctions(dim, sub_degree); - iterateSimplex(dim, sub_degree, [&](vtkVector3i sub_degree_coord, int sub_index) { - iterateSimplex(dim, lin_degree, [&](vtkVector3i lin_degree_coord, int lin_index) { - const vtkVector3i one_higher_coord = { sub_degree_coord[0] + lin_degree_coord[0], - sub_degree_coord[1] + lin_degree_coord[1], sub_degree_coord[2] + lin_degree_coord[2] }; - const int idx = FlattenSimplex(dim, sub_degree + 1, one_higher_coord); - shape_funcs[lin_index] = coeffs[idx] * linear_basis[lin_index]; + iterateSimplex(dim, sub_degree, + [&](vtkVector3i sub_degree_coord, int sub_index) + { + iterateSimplex(dim, lin_degree, + [&](vtkVector3i lin_degree_coord, int lin_index) + { + const vtkVector3i one_higher_coord = { sub_degree_coord[0] + lin_degree_coord[0], + sub_degree_coord[1] + lin_degree_coord[1], + sub_degree_coord[2] + lin_degree_coord[2] }; + const int idx = FlattenSimplex(dim, sub_degree + 1, one_higher_coord); + shape_funcs[lin_index] = coeffs[idx] * linear_basis[lin_index]; + }); + sub_coeffs[sub_index] = std::accumulate(shape_funcs.begin(), shape_funcs.end(), 0.); }); - sub_coeffs[sub_index] = std::accumulate(shape_funcs.begin(), shape_funcs.end(), 0.); - }); for (int i = 0; i < sub_degree_length; ++i) { coeffs[i] = sub_coeffs[i]; diff --git a/Common/DataModel/vtkBezierQuadrilateral.cxx b/Common/DataModel/vtkBezierQuadrilateral.cxx index 56a8b3c5d69..191dc6e243b 100644 --- a/Common/DataModel/vtkBezierQuadrilateral.cxx +++ b/Common/DataModel/vtkBezierQuadrilateral.cxx @@ -34,13 +34,14 @@ vtkCell* vtkBezierQuadrilateral::GetEdge(int edgeId) if (this->GetRationalWeights()->GetNumberOfTuples() > 0) { - const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); result->GetRationalWeights()->SetNumberOfTuples(npts); }; - const auto set_ids_and_points = [&]( - const vtkIdType& edge_id, const vtkIdType& face_id) -> void { + const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& face_id) -> void + { result->Points->SetPoint(edge_id, this->Points->GetPoint(face_id)); result->PointIds->SetId(edge_id, this->PointIds->GetId(face_id)); result->GetRationalWeights()->SetValue( @@ -50,13 +51,14 @@ vtkCell* vtkBezierQuadrilateral::GetEdge(int edgeId) } else { - const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); result->GetRationalWeights()->Reset(); }; - const auto set_ids_and_points = [&]( - const vtkIdType& edge_id, const vtkIdType& face_id) -> void { + const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& face_id) -> void + { result->Points->SetPoint(edge_id, this->Points->GetPoint(face_id)); result->PointIds->SetId(edge_id, this->PointIds->GetId(face_id)); }; diff --git a/Common/DataModel/vtkBezierTetra.cxx b/Common/DataModel/vtkBezierTetra.cxx index c1e5219252b..632d63cf163 100644 --- a/Common/DataModel/vtkBezierTetra.cxx +++ b/Common/DataModel/vtkBezierTetra.cxx @@ -33,12 +33,14 @@ vtkCell* vtkBezierTetra::GetEdge(int edgeId) vtkBezierCurve* result = EdgeCell; if (this->GetRationalWeights()->GetNumberOfTuples() > 0) { - const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); result->GetRationalWeights()->SetNumberOfTuples(npts); }; - const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& vol_id) -> void { + const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& vol_id) -> void + { result->Points->SetPoint(edge_id, this->Points->GetPoint(vol_id)); result->PointIds->SetId(edge_id, this->PointIds->GetId(vol_id)); result->GetRationalWeights()->SetValue(edge_id, this->GetRationalWeights()->GetValue(vol_id)); @@ -47,12 +49,14 @@ vtkCell* vtkBezierTetra::GetEdge(int edgeId) } else { - const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); result->GetRationalWeights()->Reset(); }; - const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& vol_id) -> void { + const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& vol_id) -> void + { result->Points->SetPoint(edge_id, this->Points->GetPoint(vol_id)); result->PointIds->SetId(edge_id, this->PointIds->GetId(vol_id)); }; @@ -67,12 +71,14 @@ vtkCell* vtkBezierTetra::GetFace(int faceId) vtkBezierTriangle* result = FaceCell; if (this->GetRationalWeights()->GetNumberOfTuples() > 0) { - const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); result->GetRationalWeights()->SetNumberOfTuples(npts); }; - const auto set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void { + const auto set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void + { result->Points->SetPoint(face_id, this->Points->GetPoint(vol_id)); result->PointIds->SetId(face_id, this->PointIds->GetId(vol_id)); result->GetRationalWeights()->SetValue(face_id, this->GetRationalWeights()->GetValue(vol_id)); @@ -82,12 +88,14 @@ vtkCell* vtkBezierTetra::GetFace(int faceId) } else { - const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); result->GetRationalWeights()->Reset(); }; - const auto set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void { + const auto set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void + { result->Points->SetPoint(face_id, this->Points->GetPoint(vol_id)); result->PointIds->SetId(face_id, this->PointIds->GetId(vol_id)); }; diff --git a/Common/DataModel/vtkBezierTriangle.cxx b/Common/DataModel/vtkBezierTriangle.cxx index 58239e02229..54f3c4cb22d 100644 --- a/Common/DataModel/vtkBezierTriangle.cxx +++ b/Common/DataModel/vtkBezierTriangle.cxx @@ -38,12 +38,14 @@ vtkCell* vtkBezierTriangle::GetEdge(int edgeId) vtkBezierCurve* result = EdgeCell; if (this->GetRationalWeights()->GetNumberOfTuples() > 0) { - const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); result->GetRationalWeights()->SetNumberOfTuples(npts); }; - const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& vol_id) -> void { + const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& vol_id) -> void + { result->Points->SetPoint(edge_id, this->Points->GetPoint(vol_id)); result->PointIds->SetId(edge_id, this->PointIds->GetId(vol_id)); result->GetRationalWeights()->SetValue(edge_id, this->GetRationalWeights()->GetValue(vol_id)); @@ -52,12 +54,14 @@ vtkCell* vtkBezierTriangle::GetEdge(int edgeId) } else { - const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); result->GetRationalWeights()->Reset(); }; - const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& vol_id) -> void { + const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& vol_id) -> void + { result->Points->SetPoint(edge_id, this->Points->GetPoint(vol_id)); result->PointIds->SetId(edge_id, this->PointIds->GetId(vol_id)); }; diff --git a/Common/DataModel/vtkBezierWedge.cxx b/Common/DataModel/vtkBezierWedge.cxx index 12fdfa7272e..5b263cce36a 100644 --- a/Common/DataModel/vtkBezierWedge.cxx +++ b/Common/DataModel/vtkBezierWedge.cxx @@ -36,12 +36,14 @@ vtkCell* vtkBezierWedge::GetEdge(int edgeId) vtkBezierCurve* result = EdgeCell; if (this->GetRationalWeights()->GetNumberOfTuples() > 0) { - const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); result->GetRationalWeights()->SetNumberOfTuples(npts); }; - const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& vol_id) -> void { + const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& vol_id) -> void + { result->Points->SetPoint(edge_id, this->Points->GetPoint(vol_id)); result->PointIds->SetId(edge_id, this->PointIds->GetId(vol_id)); result->GetRationalWeights()->SetValue(edge_id, this->GetRationalWeights()->GetValue(vol_id)); @@ -50,12 +52,14 @@ vtkCell* vtkBezierWedge::GetEdge(int edgeId) } else { - const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); result->GetRationalWeights()->Reset(); }; - const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& vol_id) -> void { + const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& vol_id) -> void + { result->Points->SetPoint(edge_id, this->Points->GetPoint(vol_id)); result->PointIds->SetId(edge_id, this->PointIds->GetId(vol_id)); }; @@ -75,12 +79,14 @@ vtkCell* vtkBezierWedge::GetFace(int faceId) vtkBezierTriangle* result = BdyTri; if (this->GetRationalWeights()->GetNumberOfTuples() > 0) { - set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); result->GetRationalWeights()->SetNumberOfTuples(npts); }; - set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void { + set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void + { result->Points->SetPoint(face_id, this->Points->GetPoint(vol_id)); result->PointIds->SetId(face_id, this->PointIds->GetId(vol_id)); result->GetRationalWeights()->SetValue( @@ -89,12 +95,14 @@ vtkCell* vtkBezierWedge::GetFace(int faceId) } else { - set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); result->GetRationalWeights()->Reset(); }; - set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void { + set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void + { result->Points->SetPoint(face_id, this->Points->GetPoint(vol_id)); result->PointIds->SetId(face_id, this->PointIds->GetId(vol_id)); }; @@ -109,12 +117,14 @@ vtkCell* vtkBezierWedge::GetFace(int faceId) vtkBezierQuadrilateral* result = BdyQuad; if (this->GetRationalWeights()->GetNumberOfTuples() > 0) { - set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); result->GetRationalWeights()->SetNumberOfTuples(npts); }; - set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void { + set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void + { result->Points->SetPoint(face_id, this->Points->GetPoint(vol_id)); result->PointIds->SetId(face_id, this->PointIds->GetId(vol_id)); result->GetRationalWeights()->SetValue( @@ -123,12 +133,14 @@ vtkCell* vtkBezierWedge::GetFace(int faceId) } else { - set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); result->GetRationalWeights()->Reset(); }; - set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void { + set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void + { result->Points->SetPoint(face_id, this->Points->GetPoint(vol_id)); result->PointIds->SetId(face_id, this->PointIds->GetId(vol_id)); }; diff --git a/Common/DataModel/vtkCellArray.h b/Common/DataModel/vtkCellArray.h index 65c35df54c5..2b7a345fc28 100644 --- a/Common/DataModel/vtkCellArray.h +++ b/Common/DataModel/vtkCellArray.h @@ -878,8 +878,8 @@ public: private: // Helpers that allow Visit to return a value: template <typename Functor, typename... Args> - using GetReturnType = decltype( - std::declval<Functor>()(std::declval<VisitState<ArrayType32>&>(), std::declval<Args>()...)); + using GetReturnType = decltype(std::declval<Functor>()( + std::declval<VisitState<ArrayType32>&>(), std::declval<Args>()...)); template <typename Functor, typename... Args> struct ReturnsVoid : std::is_same<GetReturnType<Functor, Args...>, void> @@ -1196,7 +1196,8 @@ protected: struct Storage { // Union type that switches 32 and 64 bit array storage - union ArraySwitch { + union ArraySwitch + { ArraySwitch() = default; // handled by Storage ~ArraySwitch() = default; // handle by Storage VisitState<ArrayType32>* Int32; diff --git a/Common/DataModel/vtkCellLinks.cxx b/Common/DataModel/vtkCellLinks.cxx index dac308f9e06..b4c2c65c56b 100644 --- a/Common/DataModel/vtkCellLinks.cxx +++ b/Common/DataModel/vtkCellLinks.cxx @@ -71,12 +71,14 @@ void vtkCellLinks::Allocate(vtkIdType sz, vtkIdType ext) // Allocate memory for the list of lists of cell ids. void vtkCellLinks::AllocateLinks(vtkIdType n) { - vtkSMPTools::For(0, n, [&](vtkIdType beginPtId, vtkIdType endPtId) { - for (vtkIdType ptId = beginPtId; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, n, + [&](vtkIdType beginPtId, vtkIdType endPtId) { - this->Array[ptId].cells = new vtkIdType[this->Array[ptId].ncells]; - } - }); + for (vtkIdType ptId = beginPtId; ptId < endPtId; ++ptId) + { + this->Array[ptId].cells = new vtkIdType[this->Array[ptId].ncells]; + } + }); } //------------------------------------------------------------------------------ @@ -205,7 +207,8 @@ void vtkCellLinks::SelectCells(vtkIdType minMaxDegree[2], unsigned char* cellSel { std::fill_n(cellSelection, this->NumberOfCells, 0); vtkSMPTools::For(0, this->NumberOfPoints, - [this, minMaxDegree, cellSelection](vtkIdType ptId, vtkIdType endPtId) { + [this, minMaxDegree, cellSelection](vtkIdType ptId, vtkIdType endPtId) + { for (; ptId < endPtId; ++ptId) { vtkIdType degree = this->GetNcells(0); @@ -248,15 +251,17 @@ void vtkCellLinks::DeepCopy(vtkAbstractCellLinks* src) } this->SetSequentialProcessing(src->GetSequentialProcessing()); this->Allocate(cellLinks->Size, cellLinks->Extend); - vtkSMPTools::For(0, cellLinks->MaxId + 1, [&](vtkIdType ptId, vtkIdType endPtId) { - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, cellLinks->MaxId + 1, + [&](vtkIdType ptId, vtkIdType endPtId) { - vtkIdType ncells = cellLinks->GetNcells(ptId); - this->Array[ptId].cells = new vtkIdType[ncells]; - this->Array[ptId].ncells = ncells; - std::copy_n(cellLinks->Array[ptId].cells, ncells, this->Array[ptId].cells); - } - }); + for (; ptId < endPtId; ++ptId) + { + vtkIdType ncells = cellLinks->GetNcells(ptId); + this->Array[ptId].cells = new vtkIdType[ncells]; + this->Array[ptId].ncells = ncells; + std::copy_n(cellLinks->Array[ptId].cells, ncells, this->Array[ptId].cells); + } + }); this->MaxId = cellLinks->MaxId; this->Extend = cellLinks->Extend; this->NumberOfPoints = cellLinks->NumberOfPoints; diff --git a/Common/DataModel/vtkCellMetadata.h b/Common/DataModel/vtkCellMetadata.h index 0f446fc8a0c..9ad6032805e 100644 --- a/Common/DataModel/vtkCellMetadata.h +++ b/Common/DataModel/vtkCellMetadata.h @@ -60,8 +60,9 @@ public: static bool RegisterType() { vtkStringToken name = vtk::TypeName<Subclass>(); - auto status = - vtkCellMetadata::Constructors().insert(std::make_pair(name, [](vtkCellGrid* grid) { + auto status = vtkCellMetadata::Constructors().insert(std::make_pair(name, + [](vtkCellGrid* grid) + { auto result = vtkSmartPointer<Subclass>::New(); if (result) { diff --git a/Common/DataModel/vtkDataAssembly.cxx b/Common/DataModel/vtkDataAssembly.cxx index 38c66100253..27313b999bd 100644 --- a/Common/DataModel/vtkDataAssembly.cxx +++ b/Common/DataModel/vtkDataAssembly.cxx @@ -1089,7 +1089,8 @@ void vtkDataAssembly::Visit(int id, vtkDataAssemblyVisitor* visitor, int travers if (traversal_order == vtkDataAssembly::TraversalOrder::DepthFirst) { std::function<void(const pugi::xml_node&)> iterate; - iterate = [&](const pugi::xml_node& node) { + iterate = [&](const pugi::xml_node& node) + { const auto cid = node.attribute("id").as_int(-1); vinternals.CurrentNode = node; visitor->Visit(cid); @@ -1168,7 +1169,8 @@ std::vector<int> vtkDataAssembly::SelectNodes( auto set = internals.Document.select_nodes(query.c_str()); auto notUsed = std::accumulate(set.begin(), set.end(), &visitor->UnorderedSelectedNodes, - [&internals](std::unordered_set<int>* result, const pugi::xpath_node& xnode) { + [&internals](std::unordered_set<int>* result, const pugi::xpath_node& xnode) + { if (xnode.node() == internals.Document) { // note: if xpath matches the document, the xnode is the document and not the @@ -1281,7 +1283,8 @@ void vtkDataAssembly::SubsetCopy(vtkDataAssembly* other, const std::vector<int>& std::function<void(const pugi::xml_node&, pugi::xml_node)> subset_copier; subset_copier = [&partial_subtree, &complete_subtree, &subset_copier]( - const pugi::xml_node& src, pugi::xml_node dest) -> void { + const pugi::xml_node& src, pugi::xml_node dest) -> void + { // first, copy src attributes over. for (const auto& attribute : src.attributes()) { diff --git a/Common/DataModel/vtkDataAssemblyUtilities.cxx b/Common/DataModel/vtkDataAssemblyUtilities.cxx index ed0025f1d94..82729b03b5b 100644 --- a/Common/DataModel/vtkDataAssemblyUtilities.cxx +++ b/Common/DataModel/vtkDataAssemblyUtilities.cxx @@ -198,7 +198,8 @@ bool vtkDataAssemblyUtilities::GenerateHierarchyInternal( std::map<int, unsigned int> output_node2dataset_map; - auto appendToOutput = [&](vtkDataObject* dobj, vtkInformation* metadata, int nodeid) { + auto appendToOutput = [&](vtkDataObject* dobj, vtkInformation* metadata, int nodeid) + { if (!output) { return; @@ -231,7 +232,8 @@ bool vtkDataAssemblyUtilities::GenerateHierarchyInternal( unsigned int cid = 0; std::function<void(vtkDataObject*, int, vtkInformation*)> f; - f = [&](vtkDataObject* dobj, int nodeid, vtkInformation* dobjMetaData) { + f = [&](vtkDataObject* dobj, int nodeid, vtkInformation* dobjMetaData) + { // in a hierarchy, the dataset-index corresponds to the composite index; // we add the "cid" attribute, however, to enable users to build selectors // using cid. diff --git a/Common/DataModel/vtkDataObjectTypes.cxx b/Common/DataModel/vtkDataObjectTypes.cxx index 128512517b0..04756f09f96 100644 --- a/Common/DataModel/vtkDataObjectTypes.cxx +++ b/Common/DataModel/vtkDataObjectTypes.cxx @@ -365,7 +365,8 @@ int vtkDataObjectTypes::GetCommonBaseTypeId(int typeA, int typeB) return typeA; } - auto computeBranch = [](int type) { + auto computeBranch = [](int type) + { // list immediate base-classes, no need to list any that are direct subclasses // of vtkDataObject since that's assumed by this point. static const std::map<int, int> bases = { { VTK_UNIFORM_HYPER_TREE_GRID, VTK_HYPER_TREE_GRID }, diff --git a/Common/DataModel/vtkDataSet.cxx b/Common/DataModel/vtkDataSet.cxx index f4e4bcaa1a5..b699fcf714b 100644 --- a/Common/DataModel/vtkDataSet.cxx +++ b/Common/DataModel/vtkDataSet.cxx @@ -167,14 +167,16 @@ vtkPoints* vtkDataSet::GetPoints() vtkNew<vtkDoubleArray> array; array->SetNumberOfComponents(3); array->SetNumberOfTuples(this->GetNumberOfPoints()); - vtkSMPTools::For(0, this->GetNumberOfPoints(), [&](vtkIdType begin, vtkIdType end) { - double x[3]; - for (vtkIdType pointId = begin; pointId < end; ++pointId) + vtkSMPTools::For(0, this->GetNumberOfPoints(), + [&](vtkIdType begin, vtkIdType end) { - this->GetPoint(pointId, x); - array->SetTypedTuple(pointId, x); - } - }); + double x[3]; + for (vtkIdType pointId = begin; pointId < end; ++pointId) + { + this->GetPoint(pointId, x); + array->SetTypedTuple(pointId, x); + } + }); this->TempPoints->SetData(array); return this->TempPoints; } diff --git a/Common/DataModel/vtkDataSetAttributesFieldList.cxx b/Common/DataModel/vtkDataSetAttributesFieldList.cxx index ab975fca9ed..11c3a7845c9 100644 --- a/Common/DataModel/vtkDataSetAttributesFieldList.cxx +++ b/Common/DataModel/vtkDataSetAttributesFieldList.cxx @@ -268,9 +268,8 @@ std::array<const detail::FieldInfo*, vtkDataSetAttributes::NUM_ATTRIBUTES> GetAt } std::transform(attrs.begin(), attrs.end(), accumulated_attrs.begin(), attrs.begin(), - [&](const detail::FieldInfo* prev, bool isattr) { - return isattr && prev == nullptr ? finfo : prev; - }); + [&](const detail::FieldInfo* prev, bool isattr) + { return isattr && prev == nullptr ? finfo : prev; }); } return attrs; } @@ -457,9 +456,8 @@ void vtkDataSetAttributesFieldList::IntersectFieldList(vtkDataSetAttributes* dsa // second, remove fields from accumulate collection with names not in the // intersection set. detail::remove_if(accfields, accfields.begin(), accfields.end(), - [&](const std::pair<std::string, detail::FieldInfo>& pair) { - return rkeys.find(pair.first) == rkeys.end(); - }); + [&](const std::pair<std::string, detail::FieldInfo>& pair) + { return rkeys.find(pair.first) == rkeys.end(); }); // now, since multiple fields can have same name (including empty names), // we do second intersection for fields with same names (or no names). diff --git a/Common/DataModel/vtkHyperTreeGridGeometricLocator.cxx b/Common/DataModel/vtkHyperTreeGridGeometricLocator.cxx index e1946ca6ea4..b20fc844207 100644 --- a/Common/DataModel/vtkHyperTreeGridGeometricLocator.cxx +++ b/Common/DataModel/vtkHyperTreeGridGeometricLocator.cxx @@ -645,7 +645,8 @@ bool vtkHyperTreeGridGeometricLocator::ConstructCell( cell->PointIds->SetId(iP, iP); } - auto cubePoint = [dim, origin, size](std::bitset<3>& pos, std::vector<double>* cubePt) { + auto cubePoint = [dim, origin, size](std::bitset<3>& pos, std::vector<double>* cubePt) + { for (unsigned int d = 0; d < dim; d++) { cubePt->at(d) = origin[d] + pos[d] * size[d]; @@ -674,7 +675,8 @@ void vtkHyperTreeGridGeometricLocator::GetZeroLevelOriginAndSize( double* origin, double* sizes) const { unsigned int dim = this->HTG->GetDimension(); - auto getOriginSize = [](vtkDataArray* compArray, double& ori, double& s) { + auto getOriginSize = [](vtkDataArray* compArray, double& ori, double& s) + { ori = compArray->GetComponent(0, 0); s = compArray->GetComponent(compArray->GetNumberOfTuples() - 1, 0) - ori; }; diff --git a/Common/DataModel/vtkImplicitFunction.cxx b/Common/DataModel/vtkImplicitFunction.cxx index b0004f70422..6a24f97d967 100644 --- a/Common/DataModel/vtkImplicitFunction.cxx +++ b/Common/DataModel/vtkImplicitFunction.cxx @@ -47,17 +47,19 @@ struct FunctionWorker auto dstValues = vtk::DataArrayValueRange<1>(output); using DstValueT = typename decltype(dstValues)::ValueType; - vtkSMPTools::For(0, numTuples, [&](vtkIdType begin, vtkIdType end) { - double tuple[3]; - for (vtkIdType pointId = begin; pointId < end; ++pointId) + vtkSMPTools::For(0, numTuples, + [&](vtkIdType begin, vtkIdType end) { - // GetTuple creates a copy of the tuple using GetTypedTuple if it's not a vktDataArray - // we do that since the input points can be implicit points, and GetTypedTuple is faster - // than accessing the component of the TupleReference using GetTypedComponent internally. - srcTuples.GetTuple(pointId, tuple); - dstValues[pointId] = static_cast<DstValueT>(this->F(tuple)); - } - }); + double tuple[3]; + for (vtkIdType pointId = begin; pointId < end; ++pointId) + { + // GetTuple creates a copy of the tuple using GetTypedTuple if it's not a vktDataArray + // we do that since the input points can be implicit points, and GetTypedTuple is faster + // than accessing the component of the TupleReference using GetTypedComponent internally. + srcTuples.GetTuple(pointId, tuple); + dstValues[pointId] = static_cast<DstValueT>(this->F(tuple)); + } + }); } }; diff --git a/Common/DataModel/vtkLagrangeHexahedron.cxx b/Common/DataModel/vtkLagrangeHexahedron.cxx index de92cc14abb..a34b543fa14 100644 --- a/Common/DataModel/vtkLagrangeHexahedron.cxx +++ b/Common/DataModel/vtkLagrangeHexahedron.cxx @@ -33,11 +33,13 @@ void vtkLagrangeHexahedron::PrintSelf(ostream& os, vtkIndent indent) vtkCell* vtkLagrangeHexahedron::GetEdge(int edgeId) { vtkLagrangeCurve* result = EdgeCell; - const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); }; - const auto set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void { + const auto set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void + { result->Points->SetPoint(face_id, this->Points->GetPoint(vol_id)); result->PointIds->SetId(face_id, this->PointIds->GetId(vol_id)); }; @@ -51,11 +53,13 @@ vtkCell* vtkLagrangeHexahedron::GetFace(int faceId) vtkLagrangeQuadrilateral* result = FaceCell; int faceOrder[2]; - const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); }; - const auto set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void { + const auto set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void + { result->Points->SetPoint(face_id, this->Points->GetPoint(vol_id)); result->PointIds->SetId(face_id, this->PointIds->GetId(vol_id)); }; diff --git a/Common/DataModel/vtkLagrangeQuadrilateral.cxx b/Common/DataModel/vtkLagrangeQuadrilateral.cxx index 6fedc011e3c..0481cf5840b 100644 --- a/Common/DataModel/vtkLagrangeQuadrilateral.cxx +++ b/Common/DataModel/vtkLagrangeQuadrilateral.cxx @@ -30,11 +30,13 @@ void vtkLagrangeQuadrilateral::PrintSelf(ostream& os, vtkIndent indent) vtkCell* vtkLagrangeQuadrilateral::GetEdge(int edgeId) { vtkLagrangeCurve* result = EdgeCell; - const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); }; - const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& face_id) -> void { + const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& face_id) -> void + { result->Points->SetPoint(edge_id, this->Points->GetPoint(face_id)); result->PointIds->SetId(edge_id, this->PointIds->GetId(face_id)); }; diff --git a/Common/DataModel/vtkLagrangeTetra.cxx b/Common/DataModel/vtkLagrangeTetra.cxx index 2db86a4400b..59ab86cbc71 100644 --- a/Common/DataModel/vtkLagrangeTetra.cxx +++ b/Common/DataModel/vtkLagrangeTetra.cxx @@ -28,11 +28,13 @@ void vtkLagrangeTetra::PrintSelf(ostream& os, vtkIndent indent) vtkCell* vtkLagrangeTetra::GetEdge(int edgeId) { vtkLagrangeCurve* result = EdgeCell; - const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); }; - const auto set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void { + const auto set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void + { result->Points->SetPoint(face_id, this->Points->GetPoint(vol_id)); result->PointIds->SetId(face_id, this->PointIds->GetId(vol_id)); }; @@ -44,11 +46,13 @@ vtkCell* vtkLagrangeTetra::GetEdge(int edgeId) vtkCell* vtkLagrangeTetra::GetFace(int faceId) { vtkLagrangeTriangle* result = FaceCell; - const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); }; - const auto set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void { + const auto set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void + { result->Points->SetPoint(face_id, this->Points->GetPoint(vol_id)); result->PointIds->SetId(face_id, this->PointIds->GetId(vol_id)); }; diff --git a/Common/DataModel/vtkLagrangeTriangle.cxx b/Common/DataModel/vtkLagrangeTriangle.cxx index 029252da0f8..fb5a0726b40 100644 --- a/Common/DataModel/vtkLagrangeTriangle.cxx +++ b/Common/DataModel/vtkLagrangeTriangle.cxx @@ -33,11 +33,13 @@ void vtkLagrangeTriangle::PrintSelf(ostream& os, vtkIndent indent) vtkCell* vtkLagrangeTriangle::GetEdge(int edgeId) { vtkLagrangeCurve* result = EdgeCell; - const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); }; - const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& face_id) -> void { + const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& face_id) -> void + { result->Points->SetPoint(edge_id, this->Points->GetPoint(face_id)); result->PointIds->SetId(edge_id, this->PointIds->GetId(face_id)); }; diff --git a/Common/DataModel/vtkLagrangeWedge.cxx b/Common/DataModel/vtkLagrangeWedge.cxx index 7bf1a67507d..a5c6e2aeaf3 100644 --- a/Common/DataModel/vtkLagrangeWedge.cxx +++ b/Common/DataModel/vtkLagrangeWedge.cxx @@ -34,11 +34,13 @@ void vtkLagrangeWedge::PrintSelf(ostream& os, vtkIndent indent) vtkCell* vtkLagrangeWedge::GetEdge(int edgeId) { vtkLagrangeCurve* result = EdgeCell; - const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); }; - const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& vol_id) -> void { + const auto set_ids_and_points = [&](const vtkIdType& edge_id, const vtkIdType& vol_id) -> void + { result->Points->SetPoint(edge_id, this->Points->GetPoint(vol_id)); result->PointIds->SetId(edge_id, this->PointIds->GetId(vol_id)); }; @@ -52,11 +54,13 @@ vtkCell* vtkLagrangeWedge::GetFace(int faceId) if (faceId < 2) { vtkLagrangeTriangle* result = BdyTri; - const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); }; - const auto set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void { + const auto set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void + { result->Points->SetPoint(face_id, this->Points->GetPoint(vol_id)); result->PointIds->SetId(face_id, this->PointIds->GetId(vol_id)); }; @@ -68,11 +72,13 @@ vtkCell* vtkLagrangeWedge::GetFace(int faceId) else { vtkLagrangeQuadrilateral* result = BdyQuad; - const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& npts) -> void + { result->Points->SetNumberOfPoints(npts); result->PointIds->SetNumberOfIds(npts); }; - const auto set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void { + const auto set_ids_and_points = [&](const vtkIdType& face_id, const vtkIdType& vol_id) -> void + { result->Points->SetPoint(face_id, this->Points->GetPoint(vol_id)); result->PointIds->SetId(face_id, this->PointIds->GetId(vol_id)); }; diff --git a/Common/DataModel/vtkPolyData.cxx b/Common/DataModel/vtkPolyData.cxx index e4e4bf19cd0..255a773b144 100644 --- a/Common/DataModel/vtkPolyData.cxx +++ b/Common/DataModel/vtkPolyData.cxx @@ -347,21 +347,23 @@ void vtkPolyData::ComputeCellsBounds() continue; } // Lambda to threaded mark used points - vtkSMPTools::For(0, numCells, [&](vtkIdType beginCellId, vtkIdType endCellId) { - auto cellPointIds = tlCellPointIds.Local(); - vtkIdType npts, ptIdx; - const vtkIdType* pts; - for (vtkIdType cellId = beginCellId; cellId < endCellId; ++cellId) + vtkSMPTools::For(0, numCells, + [&](vtkIdType beginCellId, vtkIdType endCellId) { - cellArray->GetCellAtId(cellId, npts, pts, cellPointIds); - for (ptIdx = 0; ptIdx < npts; ++ptIdx) + auto cellPointIds = tlCellPointIds.Local(); + vtkIdType npts, ptIdx; + const vtkIdType* pts; + for (vtkIdType cellId = beginCellId; cellId < endCellId; ++cellId) { - // memory_order_relaxed is safe here, since we're not using the atomics for - // synchronization. - ptUses[pts[ptIdx]].store(1, std::memory_order_relaxed); + cellArray->GetCellAtId(cellId, npts, pts, cellPointIds); + for (ptIdx = 0; ptIdx < npts; ++ptIdx) + { + // memory_order_relaxed is safe here, since we're not using the atomics for + // synchronization. + ptUses[pts[ptIdx]].store(1, std::memory_order_relaxed); + } } - } - }); // end lambda + }); // end lambda } vtkBoundingBox::ComputeBounds(this->Points, ptUses, this->CellsBounds); delete[] ptUses; @@ -657,7 +659,8 @@ bool vtkPolyData::AllocateExact(vtkIdType numVerts, vtkIdType vertConnSize, vtkI vtkIdType stripConnSize) { auto initCellArray = [](vtkSmartPointer<vtkCellArray>& cellArray, vtkIdType numCells, - vtkIdType connSize) -> bool { + vtkIdType connSize) -> bool + { cellArray = nullptr; if (numCells == 0 && connSize == 0) { @@ -734,7 +737,8 @@ struct BuildCellsImpl throw std::runtime_error("Cell map storage capacity exceeded."); } - auto buildCellsOperator = [&](vtkIdType begin, vtkIdType end) { + auto buildCellsOperator = [&](vtkIdType begin, vtkIdType end) + { for (vtkIdType cellId = begin, globalCellId = beginCellId + begin; cellId < end; ++cellId, ++globalCellId) { @@ -789,17 +793,19 @@ void vtkPolyData::BuildCells() if (nPolys > 0) { - polys->Visit(BuildCellsImpl{}, this->Cells, beginCellId, [](vtkIdType size) -> VTKCellType { - switch (size) + polys->Visit(BuildCellsImpl{}, this->Cells, beginCellId, + [](vtkIdType size) -> VTKCellType { - case 3: - return VTK_TRIANGLE; - case 4: - return VTK_QUAD; - default: - return VTK_POLYGON; - } - }); + switch (size) + { + case 3: + return VTK_TRIANGLE; + case 4: + return VTK_QUAD; + default: + return VTK_POLYGON; + } + }); beginCellId += nPolys; } diff --git a/Common/DataModel/vtkPolyLine.cxx b/Common/DataModel/vtkPolyLine.cxx index b8dd611310e..d0a32950dac 100644 --- a/Common/DataModel/vtkPolyLine.cxx +++ b/Common/DataModel/vtkPolyLine.cxx @@ -228,19 +228,21 @@ int vtkPolyLine::GenerateSlidingNormals( // will occur. if (threading) { - vtkSMPTools::For(0, numLines, [&](vtkIdType lineId, vtkIdType endLineId) { - vtkSmartPointer<vtkCellArrayIterator> cellIter; - cellIter.TakeReference(lines->NewIterator()); - vtkIdType npts; - const vtkIdType* linePts; - - vtkVector3d normal(0.0, 0.0, 1.0); // arbitrary default value - for (; lineId < endLineId; ++lineId) + vtkSMPTools::For(0, numLines, + [&](vtkIdType lineId, vtkIdType endLineId) { - cellIter->GetCellAtId(lineId, npts, linePts); - SlidingNormalsOnLine(pts, npts, linePts, normals, firstNormal, normal); - } - }); // lambda + vtkSmartPointer<vtkCellArrayIterator> cellIter; + cellIter.TakeReference(lines->NewIterator()); + vtkIdType npts; + const vtkIdType* linePts; + + vtkVector3d normal(0.0, 0.0, 1.0); // arbitrary default value + for (; lineId < endLineId; ++lineId) + { + cellIter->GetCellAtId(lineId, npts, linePts); + SlidingNormalsOnLine(pts, npts, linePts, normals, firstNormal, normal); + } + }); // lambda } else { @@ -453,7 +455,8 @@ void vtkPolyLine::Clip(double value, vtkDataArray* cellScalars, vtkIncrementalPo vtkNew<vtkCellArray> lines; vtkIdType numberOfCurrentLines, numberOfPreviousLines = 0; - const auto appendLines = [&]() { + const auto appendLines = [&]() + { // copy the previous lines to the output const auto numberOfPointsOfPolyLine = numberOfCurrentLines + 1; #ifdef VTK_USE_64BIT_IDS diff --git a/Common/DataModel/vtkPolyhedron.cxx b/Common/DataModel/vtkPolyhedron.cxx index 2a4bd3c05f8..72fa6cc3a8d 100644 --- a/Common/DataModel/vtkPolyhedron.cxx +++ b/Common/DataModel/vtkPolyhedron.cxx @@ -1968,7 +1968,8 @@ void vtkPolyhedron::Contour(double value, vtkDataArray* pointScalars, } // the callback lambda will add each polygon found polys cell array - std::function<void(vtkIdList*)> cb = [=](vtkIdList* poly) { + std::function<void(vtkIdList*)> cb = [=](vtkIdList* poly) + { if (!poly) return; @@ -2269,7 +2270,8 @@ void vtkPolyhedron::Clip(double value, vtkDataArray* pointScalars, vtkPointData* outPd, vtkCellData* inCd, vtkIdType cellId, vtkCellData* outCd, int insideOut) { // set the compare function - std::function<bool(double, double)> c = [insideOut](double a, double b) { + std::function<bool(double, double)> c = [insideOut](double a, double b) + { if (insideOut) return std::less_equal<double>()(a, b); @@ -2390,7 +2392,8 @@ void vtkPolyhedron::Clip(double value, vtkDataArray* pointScalars, // variables std::vector<std::vector<vtkIdType>>* pPolygons = &polygons; - std::function<void(vtkIdList*)> cb = [=](vtkIdList* poly) { + std::function<void(vtkIdList*)> cb = [=](vtkIdList* poly) + { vtkIdType nIds = poly->GetNumberOfIds(); std::vector<vtkIdType> polygon; polygon.reserve(nIds); diff --git a/Common/DataModel/vtkPolyhedronUtilities.cxx b/Common/DataModel/vtkPolyhedronUtilities.cxx index 89597c06851..ef93463ce4d 100644 --- a/Common/DataModel/vtkPolyhedronUtilities.cxx +++ b/Common/DataModel/vtkPolyhedronUtilities.cxx @@ -368,7 +368,8 @@ vtkSmartPointer<vtkUnstructuredGrid> vtkPolyhedronUtilities::Decompose( // Insert to UG a new tetra. Tetra points: // ptId1, ptId2 (forming one face edge), face barycenter, polyhedron barycenter - auto insertTetra = [&](vtkCell* face, vtkIdType ptId1, vtkIdType ptId2) { + auto insertTetra = [&](vtkCell* face, vtkIdType ptId1, vtkIdType ptId2) + { vtkIdType ptIds[4] = { 0 }; ptIds[0] = pointIdMap.at(face->GetPointId(ptId1)); ptIds[1] = barycenterId; diff --git a/Common/DataModel/vtkStaticCellLinksTemplate.txx b/Common/DataModel/vtkStaticCellLinksTemplate.txx index 2e7d3a06521..15dfb0768ff 100644 --- a/Common/DataModel/vtkStaticCellLinksTemplate.txx +++ b/Common/DataModel/vtkStaticCellLinksTemplate.txx @@ -648,14 +648,15 @@ void vtkStaticCellLinksTemplate<TIds>::DeepCopy(vtkStaticCellLinksTemplate* link this->LinkSharedPtr.reset(new TIds[this->LinksSize + 1], std::default_delete<TIds[]>()); this->Links = this->LinkSharedPtr.get(); - vtkSMPTools::For(0, this->LinksSize + 1, [&](vtkIdType beginLink, vtkIdType endLink) { - std::copy(links->Links + beginLink, links->Links + endLink, this->Links + beginLink); - }); + vtkSMPTools::For(0, this->LinksSize + 1, + [&](vtkIdType beginLink, vtkIdType endLink) + { std::copy(links->Links + beginLink, links->Links + endLink, this->Links + beginLink); }); this->OffsetsSharedPtr.reset(new TIds[this->NumPts + 1], std::default_delete<TIds[]>()); this->Offsets = this->OffsetsSharedPtr.get(); - vtkSMPTools::For(0, this->NumPts + 1, [&](vtkIdType beginPoint, vtkIdType endPoint) { - std::copy(links->Offsets + beginPoint, links->Offsets + endPoint, this->Offsets + beginPoint); - }); + vtkSMPTools::For(0, this->NumPts + 1, + [&](vtkIdType beginPoint, vtkIdType endPoint) { + std::copy(links->Offsets + beginPoint, links->Offsets + endPoint, this->Offsets + beginPoint); + }); } //---------------------------------------------------------------------------- @@ -684,8 +685,9 @@ void vtkStaticCellLinksTemplate<TIds>::SelectCells( vtkIdType minMaxDegree[2], unsigned char* cellSelection) { std::fill_n(cellSelection, this->NumCells, 0); - vtkSMPTools::For( - 0, this->NumPts, [this, minMaxDegree, cellSelection](vtkIdType ptId, vtkIdType endPtId) { + vtkSMPTools::For(0, this->NumPts, + [this, minMaxDegree, cellSelection](vtkIdType ptId, vtkIdType endPtId) + { for (; ptId < endPtId; ++ptId) { vtkIdType degree = this->Offsets[ptId + 1] - this->Offsets[ptId]; diff --git a/Common/DataModel/vtkStaticFaceHashLinksTemplate.txx b/Common/DataModel/vtkStaticFaceHashLinksTemplate.txx index fdad8861afa..df9ad06c312 100644 --- a/Common/DataModel/vtkStaticFaceHashLinksTemplate.txx +++ b/Common/DataModel/vtkStaticFaceHashLinksTemplate.txx @@ -89,8 +89,9 @@ struct vtkStaticFaceHashLinksTemplate<TInputIdType, TFaceIdType>::CountFaces numberOfCellFaces = this->Input->GetCellNumberOfFaces(cellId, cellType, cell); // we mark cells with no faces as having one face so that we can // parse them later. - numberOfFaces += - numberOfCellFaces > 0 ? numberOfCellFaces : cellType != VTK_EMPTY_CELL ? 1 : 0; + numberOfFaces += numberOfCellFaces > 0 ? numberOfCellFaces + : cellType != VTK_EMPTY_CELL ? 1 + : 0; } } } @@ -429,22 +430,24 @@ struct vtkStaticFaceHashLinksTemplate<TInputIdType, TFaceIdType>::PrefixSum { this->ThreadSum[threadId] += this->ThreadSum[threadId - 1]; } - vtkSMPTools::For(1, this->NumberOfThreads, [&](vtkIdType beginThread, vtkIdType endThread) { - const vtkIdType lastThreadId = this->NumberOfThreads - 1; - auto faceOffsets = this->FaceOffsets.get(); - for (vtkIdType threadId = beginThread; threadId < endThread; ++threadId) + vtkSMPTools::For(1, this->NumberOfThreads, + [&](vtkIdType beginThread, vtkIdType endThread) { - const vtkIdType begin = threadId * this->NumberOfHashes / this->NumberOfThreads; - const vtkIdType end = lastThreadId != threadId - ? (threadId + 1) * this->NumberOfHashes / this->NumberOfThreads - : this->NumberOfHashes; - const auto& threadLocalSum = this->ThreadSum[threadId - 1]; - for (vtkIdType pointId = begin + 1; pointId <= end; ++pointId) + const vtkIdType lastThreadId = this->NumberOfThreads - 1; + auto faceOffsets = this->FaceOffsets.get(); + for (vtkIdType threadId = beginThread; threadId < endThread; ++threadId) { - faceOffsets[pointId] += threadLocalSum; + const vtkIdType begin = threadId * this->NumberOfHashes / this->NumberOfThreads; + const vtkIdType end = lastThreadId != threadId + ? (threadId + 1) * this->NumberOfHashes / this->NumberOfThreads + : this->NumberOfHashes; + const auto& threadLocalSum = this->ThreadSum[threadId - 1]; + for (vtkIdType pointId = begin + 1; pointId <= end; ++pointId) + { + faceOffsets[pointId] += threadLocalSum; + } } - } - }); + }); } }; diff --git a/Common/DataModel/vtkStructuredCellArray.cxx b/Common/DataModel/vtkStructuredCellArray.cxx index f337d95f957..47446518d57 100644 --- a/Common/DataModel/vtkStructuredCellArray.cxx +++ b/Common/DataModel/vtkStructuredCellArray.cxx @@ -166,15 +166,15 @@ template <int DataDescription, bool UsePixelVoxelOrientation> struct vtkStructuredCellArray::vtkStructuredTCellBackend : public vtkStructuredCellBackend { // static constexpr members - static constexpr int CellSize = DataDescription == VTK_XYZ_GRID - ? 8 + static constexpr int CellSize = DataDescription == VTK_XYZ_GRID ? 8 : DataDescription == VTK_XY_PLANE || DataDescription == VTK_YZ_PLANE || - DataDescription == VTK_XZ_PLANE - ? 4 - : DataDescription == VTK_X_LINE || DataDescription == VTK_Y_LINE || - DataDescription == VTK_Z_LINE - ? 2 - : DataDescription == VTK_SINGLE_POINT ? 1 : 0; + DataDescription == VTK_XZ_PLANE + ? 4 + : DataDescription == VTK_X_LINE || DataDescription == VTK_Y_LINE || + DataDescription == VTK_Z_LINE + ? 2 + : DataDescription == VTK_SINGLE_POINT ? 1 + : 0; static constexpr vtkIdType ValidCellSize = vtkStructuredTCellBackend::CellSize > 0 ? vtkStructuredTCellBackend::CellSize : 1; diff --git a/Common/DataModel/vtkStructuredData.cxx b/Common/DataModel/vtkStructuredData.cxx index 7ab27b0ec28..039aae72c29 100644 --- a/Common/DataModel/vtkStructuredData.cxx +++ b/Common/DataModel/vtkStructuredData.cxx @@ -346,12 +346,11 @@ vtkSmartPointer<vtkConstantArray<int>> vtkStructuredData::GetCellTypesArray( { const int dataDescription = vtkStructuredData::GetDataDescriptionFromExtent(extent); const int dimension = vtkStructuredData::GetDataDimension(dataDescription); - const int cellType = dimension == 3 - ? (usePixelVoxelOrientation ? VTK_VOXEL : VTK_HEXAHEDRON) - : dimension == 2 ? (usePixelVoxelOrientation ? VTK_PIXEL : VTK_QUAD) - : dimension == 1 - ? VTK_LINE - : dimension == 0 && dataDescription == VTK_SINGLE_POINT ? VTK_VERTEX : VTK_EMPTY_CELL; + const int cellType = dimension == 3 ? (usePixelVoxelOrientation ? VTK_VOXEL : VTK_HEXAHEDRON) + : dimension == 2 ? (usePixelVoxelOrientation ? VTK_PIXEL : VTK_QUAD) + : dimension == 1 ? VTK_LINE + : dimension == 0 && dataDescription == VTK_SINGLE_POINT ? VTK_VERTEX + : VTK_EMPTY_CELL; auto cellTypesArray = vtkSmartPointer<vtkConstantArray<int>>::New(); cellTypesArray->ConstructBackend(cellType); cellTypesArray->SetNumberOfComponents(1); diff --git a/Common/Math/Testing/Cxx/UnitTestFFT.cxx b/Common/Math/Testing/Cxx/UnitTestFFT.cxx index 0e9b609dabe..b63ed388ee5 100644 --- a/Common/Math/Testing/Cxx/UnitTestFFT.cxx +++ b/Common/Math/Testing/Cxx/UnitTestFFT.cxx @@ -110,9 +110,8 @@ int Test_fft_cplx() static constexpr auto countIn = 16; static constexpr auto countOut = countIn; - auto comparator = [](vtkFFT::ComplexNumber l, vtkFFT::ComplexNumber r) { - return FuzzyCompare(l, r, std::numeric_limits<vtkFFT::ScalarNumber>::epsilon()); - }; + auto comparator = [](vtkFFT::ComplexNumber l, vtkFFT::ComplexNumber r) + { return FuzzyCompare(l, r, std::numeric_limits<vtkFFT::ScalarNumber>::epsilon()); }; auto status = 0; // Test with zeroes { @@ -202,11 +201,10 @@ int Test_fft_cplx() } else { - bool is_equal = std::equal(expected.begin(), expected.end(), - vtk::DataArrayTupleRange(res).begin(), - [](vtkFFT::ComplexNumber x, decltype(vtk::DataArrayTupleRange(res).begin())::value_type y) { - return (x.r == y[0]) && (x.i == y[1]); - }); + bool is_equal = + std::equal(expected.begin(), expected.end(), vtk::DataArrayTupleRange(res).begin(), + [](vtkFFT::ComplexNumber x, decltype(vtk::DataArrayTupleRange(res).begin())::value_type y) + { return (x.r == y[0]) && (x.i == y[1]); }); if (!is_equal) { std::cerr << "..Error when using vtkDataArrays API.."; @@ -225,9 +223,8 @@ int Test_fft_direct() static constexpr std::size_t countIn = 16; static constexpr std::size_t countOut = (countIn / 2) + 1; - auto comparator = [](vtkFFT::ComplexNumber l, vtkFFT::ComplexNumber r) { - return FuzzyCompare(l, r, std::numeric_limits<vtkFFT::ScalarNumber>::epsilon()); - }; + auto comparator = [](vtkFFT::ComplexNumber l, vtkFFT::ComplexNumber r) + { return FuzzyCompare(l, r, std::numeric_limits<vtkFFT::ScalarNumber>::epsilon()); }; auto status = 0; // zeroes std::vector<vtkFFT::ScalarNumber> zeroes(countIn, 0.0); @@ -298,7 +295,8 @@ int Test_fft_inverse() static constexpr auto countIn = 9; static constexpr auto countOut = (countIn - 1) * 2; - auto comparator = [](vtkFFT::ScalarNumber l, vtkFFT::ScalarNumber r) { + auto comparator = [](vtkFFT::ScalarNumber l, vtkFFT::ScalarNumber r) + { return vtkMathUtilities::FuzzyCompare( l, r, std::numeric_limits<vtkFFT::ScalarNumber>::epsilon()); }; @@ -341,7 +339,8 @@ int Test_fft_inverse_cplx() { std::cout << "Test_fft_inverse_cplx.."; - auto comparator = [](vtkFFT::ComplexNumber l, vtkFFT::ComplexNumber r) { + auto comparator = [](vtkFFT::ComplexNumber l, vtkFFT::ComplexNumber r) + { return vtkMathUtilities::FuzzyCompare( l.r, r.r, std::numeric_limits<vtkFFT::ScalarNumber>::epsilon()) + vtkMathUtilities::FuzzyCompare( diff --git a/Common/Math/vtkFFT.cxx b/Common/Math/vtkFFT.cxx index 6a1b0cedaff..ffbbe4f4b11 100644 --- a/Common/Math/vtkFFT.cxx +++ b/Common/Math/vtkFFT.cxx @@ -38,9 +38,10 @@ std::vector<vtkFFT::ComplexNumber> vtkFFT::Fft(const std::vector<ComplexNumber>& std::vector<vtkFFT::ComplexNumber> vtkFFT::Fft(const std::vector<ScalarNumber>& in) { std::vector<ComplexNumber> cplx(in.size()); - std::transform(in.begin(), in.end(), cplx.begin(), [](ScalarNumber x) { - return ComplexNumber{ x, 0 }; - }); + std::transform(in.begin(), in.end(), cplx.begin(), + [](ScalarNumber x) { + return ComplexNumber{ x, 0 }; + }); return vtkFFT::Fft(cplx); } @@ -48,9 +49,10 @@ std::vector<vtkFFT::ComplexNumber> vtkFFT::Fft(const std::vector<ScalarNumber>& void vtkFFT::Fft(ScalarNumber* input, std::size_t size, ComplexNumber* result) { std::vector<ComplexNumber> cplx(size); - std::transform(input, input + size, cplx.begin(), [](ScalarNumber x) { - return ComplexNumber{ x, 0 }; - }); + std::transform(input, input + size, cplx.begin(), + [](ScalarNumber x) { + return ComplexNumber{ x, 0 }; + }); vtkFFT::Fft(cplx.data(), cplx.size(), result); } @@ -91,9 +93,10 @@ vtkSmartPointer<vtkFFT::vtkScalarNumberArray> vtkFFT::Fft(vtkScalarNumberArray* rawInput = new ComplexNumber[size]; auto inputRange = vtk::DataArrayValueRange<1>(input); using ValueT = decltype(inputRange)::ConstReferenceType; - vtkSMPTools::Transform(inputRange.begin(), inputRange.end(), rawInput, [](ValueT val) { - return vtkFFT::ComplexNumber{ val, 0.0 }; - }); + vtkSMPTools::Transform(inputRange.begin(), inputRange.end(), rawInput, + [](ValueT val) { + return vtkFFT::ComplexNumber{ val, 0.0 }; + }); } auto result = vtkSmartPointer<vtkScalarNumberArray>::New(); @@ -216,9 +219,10 @@ std::vector<vtkFFT::ComplexNumber> vtkFFT::IFft(const std::vector<vtkFFT::Comple std::vector<vtkFFT::ComplexNumber> result(outSize); kiss_fft(cfg, in.data(), result.data()); - std::for_each(result.begin(), result.end(), [outSize](vtkFFT::ComplexNumber& x) { - x = vtkFFT::ComplexNumber{ x.r / outSize, x.i / outSize }; - }); + std::for_each(result.begin(), result.end(), + [outSize](vtkFFT::ComplexNumber& x) { + x = vtkFFT::ComplexNumber{ x.r / outSize, x.i / outSize }; + }); kiss_fft_free(cfg); return result; diff --git a/Common/Math/vtkFFT.txx b/Common/Math/vtkFFT.txx index 5c1fca7204f..043812a2f32 100644 --- a/Common/Math/vtkFFT.txx +++ b/Common/Math/vtkFFT.txx @@ -69,13 +69,15 @@ std::vector<vtkFFT::ComplexNumber> vtkFFT::OverlappingFft(const std::vector<T>& } std::vector<vtkFFT::ComplexNumber> result(nsegment * nfft); - vtkSMPTools::For(0, nsegment, [&](std::size_t begin, std::size_t end) { - for (std::size_t i = begin; i < end; ++i) + vtkSMPTools::For(0, nsegment, + [&](std::size_t begin, std::size_t end) { - vtkFFT::PreprocessAndDispatchFft( - sig.data() + i * segmentOffset, window, detrend, onesided, result.data() + i * nfft); - } - }); + for (std::size_t i = begin; i < end; ++i) + { + vtkFFT::PreprocessAndDispatchFft( + sig.data() + i * segmentOffset, window, detrend, onesided, result.data() + i * nfft); + } + }); return result; } @@ -98,23 +100,25 @@ vtkFFT::ComplexNumber* vtkFFT::OverlappingFft(vtkFFT::vtkScalarNumberArray* sign vtkFFT::ComplexNumber* result = new vtkFFT::ComplexNumber[outSize]; - vtkSMPTools::For(0, nsegment, [&](std::size_t begin, std::size_t end) { - for (std::size_t i = begin; i < end; ++i) + vtkSMPTools::For(0, nsegment, + [&](std::size_t begin, std::size_t end) { - if (signal->GetNumberOfComponents() == 1) + for (std::size_t i = begin; i < end; ++i) { - auto* beginSegment = - reinterpret_cast<ScalarNumber*>(signal->GetVoidPointer(i * segmentOffset)); - PreprocessAndDispatchFft(beginSegment, window, detrend, onesided, result + i * nfft); - } - else //: signal->GetNumberOfComponents() == 2 - { - auto* beginSegment = - reinterpret_cast<ComplexNumber*>(signal->GetVoidPointer(i * segmentOffset * 2)); - PreprocessAndDispatchFft(beginSegment, window, detrend, onesided, result + i * nfft); + if (signal->GetNumberOfComponents() == 1) + { + auto* beginSegment = + reinterpret_cast<ScalarNumber*>(signal->GetVoidPointer(i * segmentOffset)); + PreprocessAndDispatchFft(beginSegment, window, detrend, onesided, result + i * nfft); + } + else //: signal->GetNumberOfComponents() == 2 + { + auto* beginSegment = + reinterpret_cast<ComplexNumber*>(signal->GetVoidPointer(i * segmentOffset * 2)); + PreprocessAndDispatchFft(beginSegment, window, detrend, onesided, result + i * nfft); + } } - } - }); + }); return result; } @@ -289,9 +293,8 @@ std::vector<vtkFFT::ScalarNumber> vtkFFT::Csd(const std::vector<T>& sig, auto begin = result.cbegin() + i * shape[1]; auto end = begin + shape[1]; vtkSMPTools::Transform(begin, end, average.cbegin(), average.begin(), - [meanFactor](vtkFFT::ComplexNumber x, vtkFFT::ScalarNumber y) { - return vtkFFT::Abs(x) * meanFactor + y; - }); + [meanFactor](vtkFFT::ComplexNumber x, vtkFFT::ScalarNumber y) + { return vtkFFT::Abs(x) * meanFactor + y; }); } return average; diff --git a/Common/Transforms/vtkAbstractTransform.cxx b/Common/Transforms/vtkAbstractTransform.cxx index adb34505079..db75f76fc44 100644 --- a/Common/Transforms/vtkAbstractTransform.cxx +++ b/Common/Transforms/vtkAbstractTransform.cxx @@ -149,15 +149,17 @@ void vtkAbstractTransform::TransformPoints(vtkPoints* inPts, vtkPoints* outPts) vtkIdType m = outPts->GetNumberOfPoints(); outPts->SetNumberOfPoints(m + n); - vtkSMPTools::For(0, n, [&](vtkIdType ptId, vtkIdType endPtId) { - double point[3]; - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, n, + [&](vtkIdType ptId, vtkIdType endPtId) { - inPts->GetPoint(ptId, point); - this->InternalTransformPoint(point, point); - outPts->SetPoint(m + ptId, point); - } - }); + double point[3]; + for (; ptId < endPtId; ++ptId) + { + inPts->GetPoint(ptId, point); + this->InternalTransformPoint(point, point); + outPts->SetPoint(m + ptId, point); + } + }); } //------------------------------------------------------------------------------ @@ -193,40 +195,42 @@ void vtkAbstractTransform::TransformPointsNormalsVectors(vtkPoints* inPts, vtkPo outNms->SetNumberOfTuples(m + n); } - vtkSMPTools::For(0, n, [&](vtkIdType ptId, vtkIdType endPtId) { - double matrix[3][3]; - double point[3]; - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, n, + [&](vtkIdType ptId, vtkIdType endPtId) { - inPts->GetPoint(ptId, point); - this->InternalTransformDerivative(point, point, matrix); - outPts->SetPoint(m + ptId, point); - - if (inVrs) + double matrix[3][3]; + double point[3]; + for (; ptId < endPtId; ++ptId) { - inVrs->GetTuple(ptId, point); - vtkMath::Multiply3x3(matrix, point, point); - outVrs->SetTuple(m + ptId, point); - } - if (inVrsArr) - { - for (int iArr = 0; iArr < nOptionalVectors; iArr++) + inPts->GetPoint(ptId, point); + this->InternalTransformDerivative(point, point, matrix); + outPts->SetPoint(m + ptId, point); + + if (inVrs) { - inVrsArr[iArr]->GetTuple(ptId, point); + inVrs->GetTuple(ptId, point); vtkMath::Multiply3x3(matrix, point, point); - outVrsArr[iArr]->SetTuple(m + ptId, point); + outVrs->SetTuple(m + ptId, point); + } + if (inVrsArr) + { + for (int iArr = 0; iArr < nOptionalVectors; iArr++) + { + inVrsArr[iArr]->GetTuple(ptId, point); + vtkMath::Multiply3x3(matrix, point, point); + outVrsArr[iArr]->SetTuple(m + ptId, point); + } + } + if (inNms) + { + inNms->GetTuple(ptId, point); + vtkMath::Transpose3x3(matrix, matrix); + vtkMath::LinearSolve3x3(matrix, point, point); + vtkMath::Normalize(point); + outNms->SetTuple(m + ptId, point); } } - if (inNms) - { - inNms->GetTuple(ptId, point); - vtkMath::Transpose3x3(matrix, matrix); - vtkMath::LinearSolve3x3(matrix, point, point); - vtkMath::Normalize(point); - outNms->SetTuple(m + ptId, point); - } - } - }); + }); } //------------------------------------------------------------------------------ diff --git a/Common/Transforms/vtkHomogeneousTransform.cxx b/Common/Transforms/vtkHomogeneousTransform.cxx index 309e69c8f52..e4d5926a4fe 100644 --- a/Common/Transforms/vtkHomogeneousTransform.cxx +++ b/Common/Transforms/vtkHomogeneousTransform.cxx @@ -119,15 +119,17 @@ void vtkHomogeneousTransform::TransformPoints(vtkPoints* inPts, vtkPoints* outPt this->Update(); - vtkSMPTools::For(0, n, vtkSMPTools::THRESHOLD, [&](vtkIdType ptId, vtkIdType endPtId) { - double point[3]; - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, n, vtkSMPTools::THRESHOLD, + [&](vtkIdType ptId, vtkIdType endPtId) { - inPts->GetPoint(ptId, point); - vtkHomogeneousTransformPoint(M, point, point); - outPts->SetPoint(m + ptId, point); - } - }); + double point[3]; + for (; ptId < endPtId; ++ptId) + { + inPts->GetPoint(ptId, point); + vtkHomogeneousTransformPoint(M, point, point); + outPts->SetPoint(m + ptId, point); + } + }); } //------------------------------------------------------------------------------ @@ -169,51 +171,53 @@ void vtkHomogeneousTransform::TransformPointsNormalsVectors(vtkPoints* inPts, vt vtkMatrix4x4::Transpose(*L, *L); } - vtkSMPTools::For(0, n, vtkSMPTools::THRESHOLD, [&](vtkIdType ptId, vtkIdType endPtId) { - double inPnt[3], outPnt[3], inNrm[3], outNrm[3], inVec[3], outVec[3]; - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, n, vtkSMPTools::THRESHOLD, + [&](vtkIdType ptId, vtkIdType endPtId) { - inPts->GetPoint(ptId, inPnt); - - // do the coordinate transformation, get 1/w - double f = vtkHomogeneousTransformPoint(M, inPnt, outPnt); - outPts->SetPoint(m + ptId, outPnt); - - if (inVrs) + double inPnt[3], outPnt[3], inNrm[3], outNrm[3], inVec[3], outVec[3]; + for (; ptId < endPtId; ++ptId) { - inVrs->GetTuple(ptId, inVec); - TransformVector(M, outPnt, f, inVec, outVec); - outVrs->SetTuple(m + ptId, outVec); - } + inPts->GetPoint(ptId, inPnt); - if (inVrsArr) - { - for (int iArr = 0; iArr < nOptionalVectors; iArr++) + // do the coordinate transformation, get 1/w + double f = vtkHomogeneousTransformPoint(M, inPnt, outPnt); + outPts->SetPoint(m + ptId, outPnt); + + if (inVrs) { - inVrsArr[iArr]->GetTuple(ptId, inVec); + inVrs->GetTuple(ptId, inVec); TransformVector(M, outPnt, f, inVec, outVec); - outVrsArr[iArr]->SetTuple(m + ptId, outVec); + outVrs->SetTuple(m + ptId, outVec); } - } - if (inNms) - { - inNms->GetTuple(ptId, inNrm); + if (inVrsArr) + { + for (int iArr = 0; iArr < nOptionalVectors; iArr++) + { + inVrsArr[iArr]->GetTuple(ptId, inVec); + TransformVector(M, outPnt, f, inVec, outVec); + outVrsArr[iArr]->SetTuple(m + ptId, outVec); + } + } - // calculate the w component of the normal - double w = -(inNrm[0] * inPnt[0] + inNrm[1] * inPnt[1] + inNrm[2] * inPnt[2]); + if (inNms) + { + inNms->GetTuple(ptId, inNrm); + + // calculate the w component of the normal + double w = -(inNrm[0] * inPnt[0] + inNrm[1] * inPnt[1] + inNrm[2] * inPnt[2]); - // perform the transformation in homogeneous coordinates - outNrm[0] = L[0][0] * inNrm[0] + L[0][1] * inNrm[1] + L[0][2] * inNrm[2] + L[0][3] * w; - outNrm[1] = L[1][0] * inNrm[0] + L[1][1] * inNrm[1] + L[1][2] * inNrm[2] + L[1][3] * w; - outNrm[2] = L[2][0] * inNrm[0] + L[2][1] * inNrm[1] + L[2][2] * inNrm[2] + L[2][3] * w; + // perform the transformation in homogeneous coordinates + outNrm[0] = L[0][0] * inNrm[0] + L[0][1] * inNrm[1] + L[0][2] * inNrm[2] + L[0][3] * w; + outNrm[1] = L[1][0] * inNrm[0] + L[1][1] * inNrm[1] + L[1][2] * inNrm[2] + L[1][3] * w; + outNrm[2] = L[2][0] * inNrm[0] + L[2][1] * inNrm[1] + L[2][2] * inNrm[2] + L[2][3] * w; - // re-normalize - vtkMath::Normalize(outNrm); - outNms->SetTuple(m + ptId, outNrm); + // re-normalize + vtkMath::Normalize(outNrm); + outNms->SetTuple(m + ptId, outNrm); + } } - } - }); + }); } //------------------------------------------------------------------------------ diff --git a/Common/Transforms/vtkIdentityTransform.cxx b/Common/Transforms/vtkIdentityTransform.cxx index 1f30001f260..1ba96d32751 100644 --- a/Common/Transforms/vtkIdentityTransform.cxx +++ b/Common/Transforms/vtkIdentityTransform.cxx @@ -143,14 +143,16 @@ void vtkIdentityTransform::TransformPoints(vtkPoints* inPts, vtkPoints* outPts) vtkIdType m = outPts->GetNumberOfPoints(); outPts->SetNumberOfPoints(m + n); - vtkSMPTools::For(0, n, vtkSMPTools::THRESHOLD, [&](vtkIdType ptId, vtkIdType endPtId) { - double point[3]; - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, n, vtkSMPTools::THRESHOLD, + [&](vtkIdType ptId, vtkIdType endPtId) { - inPts->GetPoint(ptId, point); - outPts->SetPoint(m + ptId, point); - } - }); + double point[3]; + for (; ptId < endPtId; ++ptId) + { + inPts->GetPoint(ptId, point); + outPts->SetPoint(m + ptId, point); + } + }); } //------------------------------------------------------------------------------ @@ -160,14 +162,16 @@ void vtkIdentityTransform::TransformNormals(vtkDataArray* inNms, vtkDataArray* o vtkIdType m = outNms->GetNumberOfTuples(); outNms->SetNumberOfTuples(m + n); - vtkSMPTools::For(0, n, vtkSMPTools::THRESHOLD, [&](vtkIdType ptId, vtkIdType endPtId) { - double normal[3]; - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, n, vtkSMPTools::THRESHOLD, + [&](vtkIdType ptId, vtkIdType endPtId) { - inNms->GetTuple(ptId, normal); - outNms->SetTuple(m + ptId, normal); - } - }); + double normal[3]; + for (; ptId < endPtId; ++ptId) + { + inNms->GetTuple(ptId, normal); + outNms->SetTuple(m + ptId, normal); + } + }); } //------------------------------------------------------------------------------ @@ -177,13 +181,15 @@ void vtkIdentityTransform::TransformVectors(vtkDataArray* inVrs, vtkDataArray* o vtkIdType m = outVrs->GetNumberOfTuples(); outVrs->SetNumberOfTuples(m + n); - vtkSMPTools::For(0, n, vtkSMPTools::THRESHOLD, [&](vtkIdType ptId, vtkIdType endPtId) { - double vect[3]; - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, n, vtkSMPTools::THRESHOLD, + [&](vtkIdType ptId, vtkIdType endPtId) { - inVrs->GetTuple(ptId, vect); - outVrs->SetTuple(m + ptId, vect); - } - }); + double vect[3]; + for (; ptId < endPtId; ++ptId) + { + inVrs->GetTuple(ptId, vect); + outVrs->SetTuple(m + ptId, vect); + } + }); } VTK_ABI_NAMESPACE_END diff --git a/Common/Transforms/vtkLinearTransform.cxx b/Common/Transforms/vtkLinearTransform.cxx index 7dd1b3b5209..38cd2d720e8 100644 --- a/Common/Transforms/vtkLinearTransform.cxx +++ b/Common/Transforms/vtkLinearTransform.cxx @@ -82,16 +82,18 @@ inline void vtkLinearTransformPoints(T1 matrix[4][4], T2* in, T3* out, vtkIdType { // We use THRESHOLD to test if the data size is small enough // to execute the functor serially. It's faster for a smaller number of transformation. - vtkSMPTools::For(0, n, vtkSMPTools::THRESHOLD, [&](vtkIdType ptId, vtkIdType endPtId) { - T2* pin = in + 3 * ptId; - T3* pout = out + 3 * ptId; - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, n, vtkSMPTools::THRESHOLD, + [&](vtkIdType ptId, vtkIdType endPtId) { - vtkLinearTransformPoint(matrix, pin, pout); - pin += 3; - pout += 3; - } - }); + T2* pin = in + 3 * ptId; + T3* pout = out + 3 * ptId; + for (; ptId < endPtId; ++ptId) + { + vtkLinearTransformPoint(matrix, pin, pout); + pin += 3; + pout += 3; + } + }); } //------------------------------------------------------------------------------ @@ -100,16 +102,18 @@ inline void vtkLinearTransformVectors(T1 matrix[4][4], T2* in, T3* out, vtkIdTyp { // We use THRESHOLD to test if the data size is small enough // to execute the functor serially. It's faster for a smaller number of transformation. - vtkSMPTools::For(0, n, vtkSMPTools::THRESHOLD, [&](vtkIdType ptId, vtkIdType endPtId) { - T2* pin = in + 3 * ptId; - T3* pout = out + 3 * ptId; - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, n, vtkSMPTools::THRESHOLD, + [&](vtkIdType ptId, vtkIdType endPtId) { - vtkLinearTransformVector(matrix, pin, pout); - pin += 3; - pout += 3; - } - }); + T2* pin = in + 3 * ptId; + T3* pout = out + 3 * ptId; + for (; ptId < endPtId; ++ptId) + { + vtkLinearTransformVector(matrix, pin, pout); + pin += 3; + pout += 3; + } + }); } //------------------------------------------------------------------------------ @@ -118,18 +122,20 @@ inline void vtkLinearTransformNormals(T1 matrix[4][4], T2* in, T3* out, vtkIdTyp { // We use THRESHOLD to test if the data size is small enough // to execute the functor serially. It's faster for a smaller number of transformation. - vtkSMPTools::For(0, n, vtkSMPTools::THRESHOLD, [&](vtkIdType ptId, vtkIdType endPtId) { - T2* pin = in + 3 * ptId; - T3* pout = out + 3 * ptId; - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, n, vtkSMPTools::THRESHOLD, + [&](vtkIdType ptId, vtkIdType endPtId) { - // matrix has been transposed & inverted, so use TransformVector - vtkLinearTransformVector(matrix, pin, pout); - vtkMath::Normalize(pout); - pin += 3; - pout += 3; - } - }); + T2* pin = in + 3 * ptId; + T3* pout = out + 3 * ptId; + for (; ptId < endPtId; ++ptId) + { + // matrix has been transposed & inverted, so use TransformVector + vtkLinearTransformVector(matrix, pin, pout); + vtkMath::Normalize(pout); + pin += 3; + pout += 3; + } + }); } } // anonymous namespace @@ -249,15 +255,17 @@ void vtkLinearTransform::TransformPoints(vtkPoints* inPts, vtkPoints* outPts) else { // for anything that isn't float or double - vtkSMPTools::For(0, n, vtkSMPTools::THRESHOLD, [&](vtkIdType ptId, vtkIdType endPtId) { - double point[3]; - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, n, vtkSMPTools::THRESHOLD, + [&](vtkIdType ptId, vtkIdType endPtId) { - inPts->GetPoint(ptId, point); - vtkLinearTransformPoint(matrix, point, point); - outPts->SetPoint(m + ptId, point); - } - }); + double point[3]; + for (; ptId < endPtId; ++ptId) + { + inPts->GetPoint(ptId, point); + vtkLinearTransformPoint(matrix, point, point); + outPts->SetPoint(m + ptId, point); + } + }); } } @@ -300,17 +308,19 @@ void vtkLinearTransform::TransformNormals(vtkDataArray* inNms, vtkDataArray* out else { // for anything that isn't float or double - vtkSMPTools::For(0, n, vtkSMPTools::THRESHOLD, [&](vtkIdType ptId, vtkIdType endPtId) { - double norm[3]; - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, n, vtkSMPTools::THRESHOLD, + [&](vtkIdType ptId, vtkIdType endPtId) { - inNms->GetTuple(ptId, norm); - // use TransformVector because matrix is already transposed & inverted - vtkLinearTransformVector(matrix, norm, norm); - vtkMath::Normalize(norm); - outNms->SetTuple(m + ptId, norm); - } - }); + double norm[3]; + for (; ptId < endPtId; ++ptId) + { + inNms->GetTuple(ptId, norm); + // use TransformVector because matrix is already transposed & inverted + vtkLinearTransformVector(matrix, norm, norm); + vtkMath::Normalize(norm); + outNms->SetTuple(m + ptId, norm); + } + }); } } @@ -349,15 +359,17 @@ void vtkLinearTransform::TransformVectors(vtkDataArray* inVrs, vtkDataArray* out else { // for anything that isn't float or double - vtkSMPTools::For(0, n, vtkSMPTools::THRESHOLD, [&](vtkIdType ptId, vtkIdType endPtId) { - double vec[3]; - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, n, vtkSMPTools::THRESHOLD, + [&](vtkIdType ptId, vtkIdType endPtId) { - inVrs->GetTuple(ptId, vec); - vtkLinearTransformVector(matrix, vec, vec); - outVrs->SetTuple(m + ptId, vec); - } - }); + double vec[3]; + for (; ptId < endPtId; ++ptId) + { + inVrs->GetTuple(ptId, vec); + vtkLinearTransformVector(matrix, vec, vec); + outVrs->SetTuple(m + ptId, vec); + } + }); } } VTK_ABI_NAMESPACE_END diff --git a/Common/Transforms/vtkThinPlateSplineTransform.cxx b/Common/Transforms/vtkThinPlateSplineTransform.cxx index a6eb3cf9879..e20fe2bfeb3 100644 --- a/Common/Transforms/vtkThinPlateSplineTransform.cxx +++ b/Common/Transforms/vtkThinPlateSplineTransform.cxx @@ -26,7 +26,7 @@ inline double** vtkNewMatrix(int rows, int cols) //------------------------------------------------------------------------------ inline void vtkDeleteMatrix(double** m) { - delete[] * m; + delete[] *m; delete[] m; } diff --git a/Examples/Charts/Cxx/GraphItem.cxx b/Examples/Charts/Cxx/GraphItem.cxx index 9d3e071d36c..8a3a46a5ef5 100644 --- a/Examples/Charts/Cxx/GraphItem.cxx +++ b/Examples/Charts/Cxx/GraphItem.cxx @@ -17,7 +17,7 @@ // NOTE: @hcwiley commented this out as its not being used, and causes builds // to fail with examples on but testing off. Why is this included? -//#include "vtkRegressionTestImage.h" +// #include "vtkRegressionTestImage.h" class GraphAnimate : public vtkCommand { diff --git a/Examples/Emscripten/Cxx/MultiCone/MultiCone.cxx b/Examples/Emscripten/Cxx/MultiCone/MultiCone.cxx index c269c0c7054..dfc3941ab90 100644 --- a/Examples/Emscripten/Cxx/MultiCone/MultiCone.cxx +++ b/Examples/Emscripten/Cxx/MultiCone/MultiCone.cxx @@ -94,7 +94,10 @@ extern "C" std::cout << "c++::stop - end" << std::endl; } - int getConeResolution() { return coneSource->GetResolution(); } + int getConeResolution() + { + return coneSource->GetResolution(); + } void setConeResolution(int resolution) { diff --git a/Examples/Emscripten/Cxx/WrappedAsyncClipper/WrappedAsyncClipper.cxx b/Examples/Emscripten/Cxx/WrappedAsyncClipper/WrappedAsyncClipper.cxx index 3dbb53d1999..e5a8d2712a2 100644 --- a/Examples/Emscripten/Cxx/WrappedAsyncClipper/WrappedAsyncClipper.cxx +++ b/Examples/Emscripten/Cxx/WrappedAsyncClipper/WrappedAsyncClipper.cxx @@ -95,12 +95,14 @@ void WrappedAsyncClipper::SyncRender() LOG(__func__); if (this->m_RenderWindow != nullptr) { - this->m_Queue.proxySync(this->m_RenderThread, [this]() { - LOG("WrappedAsyncClipper::RenderWindow::Render"); - // Clear abort execute flag in case filter was aborted. - this->m_Clipper->SetAbortExecute(false); - this->m_RenderWindow->Render(); - }); + this->m_Queue.proxySync(this->m_RenderThread, + [this]() + { + LOG("WrappedAsyncClipper::RenderWindow::Render"); + // Clear abort execute flag in case filter was aborted. + this->m_Clipper->SetAbortExecute(false); + this->m_RenderWindow->Render(); + }); } } @@ -110,12 +112,14 @@ void WrappedAsyncClipper::AsyncRender() LOG(__func__); if (this->m_RenderWindow != nullptr) { - this->m_Queue.proxyAsync(this->m_RenderThread, [this]() { - LOG("vtkRenderWindow::Render"); - // Clear abort execute flag in case filter was aborted. - this->m_Clipper->SetAbortExecute(false); - this->m_RenderWindow->Render(); - }); + this->m_Queue.proxyAsync(this->m_RenderThread, + [this]() + { + LOG("vtkRenderWindow::Render"); + // Clear abort execute flag in case filter was aborted. + this->m_Clipper->SetAbortExecute(false); + this->m_RenderWindow->Render(); + }); } } @@ -285,23 +289,29 @@ void WrappedAsyncClipper::AddClipPlaneModifiedUIObserver(ClipPlaneModifiedCallba this->m_ClipPlaneCmd = vtk::TakeSmartPointer(vtkCallbackCommand::New()); this->m_ClipPlaneCmd->SetClientData(bridge); - this->m_ClipPlaneCmd->SetClientDataDeleteCallback([](void* clientdata) { - if (auto* _bridge = reinterpret_cast<CallbackOnThreadBridge*>(clientdata)) + this->m_ClipPlaneCmd->SetClientDataDeleteCallback( + [](void* clientdata) { - delete _bridge; - } - }); - this->m_ClipPlaneCmd->SetCallback([](vtkObject* caller, unsigned long, void* clientdata, void*) { - if (auto* _bridge = reinterpret_cast<CallbackOnThreadBridge*>(clientdata)) + if (auto* _bridge = reinterpret_cast<CallbackOnThreadBridge*>(clientdata)) + { + delete _bridge; + } + }); + this->m_ClipPlaneCmd->SetCallback( + [](vtkObject* caller, unsigned long, void* clientdata, void*) { - auto* plane = reinterpret_cast<vtkPlane*>(caller); - _bridge->Queue->proxyAsync(*(_bridge->Target), [plane, f = _bridge->Call]() { - double n[3] = {}; - plane->GetNormal(n); - f(n[0], n[1], n[2]); - }); - } - }); + if (auto* _bridge = reinterpret_cast<CallbackOnThreadBridge*>(clientdata)) + { + auto* plane = reinterpret_cast<vtkPlane*>(caller); + _bridge->Queue->proxyAsync(*(_bridge->Target), + [plane, f = _bridge->Call]() + { + double n[3] = {}; + plane->GetNormal(n); + f(n[0], n[1], n[2]); + }); + } + }); } //--------------------------------------------------------------------- diff --git a/Examples/Emscripten/Cxx/WrappedAsyncClipper/WrappedAsyncClipper.h b/Examples/Emscripten/Cxx/WrappedAsyncClipper/WrappedAsyncClipper.h index 64cde25c271..1a7a9ab5473 100644 --- a/Examples/Emscripten/Cxx/WrappedAsyncClipper/WrappedAsyncClipper.h +++ b/Examples/Emscripten/Cxx/WrappedAsyncClipper/WrappedAsyncClipper.h @@ -99,16 +99,18 @@ EMSCRIPTEN_BINDINGS(WrappedAsyncClipperBindings) .function("ResetAbortFlag", &WrappedAsyncClipper::ResetAbortFlag) .function("UpdateClipPlaneNormal", &WrappedAsyncClipper::UpdateClipPlaneNormal) .function("AddClipPlaneModifiedUIObserver", - emscripten::optional_override([](WrappedAsyncClipper& self, emscripten::val jsFunc) { - // the `jsFunc` must be a javascript function that takes 3 doubles and returns nothing. - // Here, we dynamically "import" the javascript function into the wasm table by using - // an emscripten library function called "addFunction". That must be in the list of - // EXPORTED_RUNTIME_METHODS in the link flags. See CMakeLists.txt. - int fp = - emscripten::val::module_property("addFunction")(jsFunc, std::string("vddd")).as<int>(); - auto callback = reinterpret_cast<WrappedAsyncClipper::ClipPlaneModifiedCallbackType>(fp); - self.AddClipPlaneModifiedUIObserver(callback); - })) + emscripten::optional_override( + [](WrappedAsyncClipper& self, emscripten::val jsFunc) + { + // the `jsFunc` must be a javascript function that takes 3 doubles and returns nothing. + // Here, we dynamically "import" the javascript function into the wasm table by using + // an emscripten library function called "addFunction". That must be in the list of + // EXPORTED_RUNTIME_METHODS in the link flags. See CMakeLists.txt. + int fp = + emscripten::val::module_property("addFunction")(jsFunc, std::string("vddd")).as<int>(); + auto callback = reinterpret_cast<WrappedAsyncClipper::ClipPlaneModifiedCallbackType>(fp); + self.AddClipPlaneModifiedUIObserver(callback); + })) .function("SyncRender", &WrappedAsyncClipper::SyncRender) .function("AsyncRender", &WrappedAsyncClipper::AsyncRender) .function("Start", &WrappedAsyncClipper::Start); diff --git a/Examples/Emscripten/Cxx/WrappedMace/WrappedMace.cxx b/Examples/Emscripten/Cxx/WrappedMace/WrappedMace.cxx index e5b748c7565..16d5021381d 100644 --- a/Examples/Emscripten/Cxx/WrappedMace/WrappedMace.cxx +++ b/Examples/Emscripten/Cxx/WrappedMace/WrappedMace.cxx @@ -57,9 +57,8 @@ EMSCRIPTEN_BINDINGS(webtest) emscripten::allow_raw_pointers()) .function("SetInputConnection", emscripten::select_overload<void(vtkAlgorithm&, vtkAlgorithmOutput*)>( - [](vtkAlgorithm& self, vtkAlgorithmOutput* ptr) { - self.vtkAlgorithm::SetInputConnection(ptr); - }), + [](vtkAlgorithm& self, vtkAlgorithmOutput* ptr) + { self.vtkAlgorithm::SetInputConnection(ptr); }), emscripten::allow_raw_pointers()); // vtkAlgorithmOutput ----------------------------------------------- @@ -78,9 +77,8 @@ EMSCRIPTEN_BINDINGS(webtest) .function("SetScaleFactor", &vtkGlyph3D::SetScaleFactor) .function("SetSourceConnection", emscripten::select_overload<void(vtkGlyph3D&, vtkAlgorithmOutput*)>( - [](vtkGlyph3D& self, vtkAlgorithmOutput* ptr) { - self.vtkGlyph3D::SetSourceConnection(ptr); - }), + [](vtkGlyph3D& self, vtkAlgorithmOutput* ptr) + { self.vtkGlyph3D::SetSourceConnection(ptr); }), emscripten::allow_raw_pointers()); // vtkMapper -------------------------------------------------------- @@ -111,9 +109,9 @@ EMSCRIPTEN_BINDINGS(webtest) // vtkRenderWindowInteractor ---------------------------------------- emscripten::class_<vtkRenderWindowInteractor>("vtkRenderWindowInteractor") .constructor(&vtkRenderWindowInteractor::New, emscripten::allow_raw_pointers()) - .class_function("configure", emscripten::select_overload<void()>([]() { - vtkRenderWindowInteractor::InteractorManagesTheEventLoop = false; - })) + .class_function("configure", + emscripten::select_overload<void()>( + []() { vtkRenderWindowInteractor::InteractorManagesTheEventLoop = false; })) .function("Start", &vtkRenderWindowInteractor::Start) .function("SetRenderWindow", &vtkRenderWindowInteractor::SetRenderWindow, emscripten::allow_raw_pointers()); @@ -128,7 +126,6 @@ EMSCRIPTEN_BINDINGS(webtest) emscripten::class_<vtkViewport>("vtkViewport") .function("SetBackground", emscripten::select_overload<void(vtkViewport&, double, double, double)>( - [](vtkViewport& self, double r, double g, double b) { - self.vtkViewport::SetBackground(r, g, b); - })); + [](vtkViewport& self, double r, double g, double b) + { self.vtkViewport::SetBackground(r, g, b); })); } diff --git a/Examples/GUI/Cocoa/CustomLayer.mm b/Examples/GUI/Cocoa/CustomLayer.mm index 0b67bf66a53..dc5c4b1cd5a 100644 --- a/Examples/GUI/Cocoa/CustomLayer.mm +++ b/Examples/GUI/Cocoa/CustomLayer.mm @@ -25,7 +25,7 @@ assert(customView); // Tell VTK to render. - assert([customView renderWindowInteractor] -> GetInitialized()); + assert([customView renderWindowInteractor]->GetInitialized()); vtkCocoaRenderWindow* renderWindow = [customView renderWindow]; if (renderWindow && renderWindow->GetMapped()) { @@ -63,7 +63,7 @@ assert(renderWindow); // Get the OpenGL context from VTK. - assert([customView renderWindowInteractor] -> GetInitialized()); + assert([customView renderWindowInteractor]->GetInitialized()); NSOpenGLContext* openGLContext = (__bridge NSOpenGLContext*)(renderWindow->GetContextId()); assert(openGLContext); diff --git a/Examples/GUI/Cocoa/CustomView.h b/Examples/GUI/Cocoa/CustomView.h index c8bdc65185c..e0d52b561df 100644 --- a/Examples/GUI/Cocoa/CustomView.h +++ b/Examples/GUI/Cocoa/CustomView.h @@ -4,7 +4,7 @@ #import "vtkRenderWindow.h" #import "vtkRenderer.h" -//#import "vtkRenderWindowInteractor.h" +// #import "vtkRenderWindowInteractor.h" #import "vtkCocoaRenderWindow.h" #import "vtkCocoaRenderWindowInteractor.h" diff --git a/Examples/GUI/Cocoa/MyWindowController.mm b/Examples/GUI/Cocoa/MyWindowController.mm index ef297a5e498..9df22c50c84 100644 --- a/Examples/GUI/Cocoa/MyWindowController.mm +++ b/Examples/GUI/Cocoa/MyWindowController.mm @@ -66,7 +66,7 @@ vtkSmartPointer<vtkInteractorStyleSwitch> intStyle = vtkSmartPointer<vtkInteractorStyleSwitch>::New(); intStyle->SetCurrentStyleToTrackballCamera(); - [thisView getInteractor] -> SetInteractorStyle(intStyle); + [thisView getInteractor]->SetInteractorStyle(intStyle); // Create a cone, see the "VTK User's Guide" for details vtkSmartPointer<vtkConeSource> cone = vtkSmartPointer<vtkConeSource>::New(); @@ -80,7 +80,7 @@ vtkSmartPointer<vtkActor> coneActor = vtkSmartPointer<vtkActor>::New(); coneActor->SetMapper(coneMapper); - [thisView getRenderer] -> AddActor(coneActor); + [thisView getRenderer]->AddActor(coneActor); // Create a text actor. NSString* string = @"日本語"; @@ -96,7 +96,7 @@ vtkCoordinate* coord = textActor->GetPositionCoordinate(); coord->SetCoordinateSystemToWorld(); coord->SetValue(0.0, 0.5, 0.0); - [thisView getRenderer] -> AddViewProp(textActor); + [thisView getRenderer]->AddViewProp(textActor); // Tell the system that the view needs to be redrawn [thisView setNeedsDisplay:YES]; @@ -122,7 +122,7 @@ vtkSmartPointer<vtkInteractorStyleSwitch> intStyle = vtkSmartPointer<vtkInteractorStyleSwitch>::New(); intStyle->SetCurrentStyleToTrackballCamera(); - [thisView getInteractor] -> SetInteractorStyle(intStyle); + [thisView getInteractor]->SetInteractorStyle(intStyle); // Create a cylinder, see the "VTK User's Guide" for details vtkSmartPointer<vtkCylinderSource> cylinder = vtkSmartPointer<vtkCylinderSource>::New(); @@ -134,7 +134,7 @@ vtkSmartPointer<vtkActor> cylinderActor = vtkSmartPointer<vtkActor>::New(); cylinderActor->SetMapper(cylinderMapper); - [thisView getRenderer] -> AddActor(cylinderActor); + [thisView getRenderer]->AddActor(cylinderActor); // Create a text actor. NSString* string = @"日本語"; @@ -150,7 +150,7 @@ vtkCoordinate* coord = textActor->GetPositionCoordinate(); coord->SetCoordinateSystemToWorld(); coord->SetValue(0.3, 0.5, 0.0); - [thisView getRenderer] -> AddViewProp(textActor); + [thisView getRenderer]->AddViewProp(textActor); // Tell the system that the view needs to be redrawn [thisView setNeedsDisplay:YES]; @@ -177,7 +177,7 @@ vtkSmartPointer<vtkInteractorStyleSwitch> intStyle = vtkSmartPointer<vtkInteractorStyleSwitch>::New(); intStyle->SetCurrentStyleToTrackballCamera(); - [thisView renderWindowInteractor] -> SetInteractorStyle(intStyle); + [thisView renderWindowInteractor]->SetInteractorStyle(intStyle); // Create a cylinder, see the "VTK User's Guide" for details vtkSmartPointer<vtkCylinderSource> cylinder = vtkSmartPointer<vtkCylinderSource>::New(); @@ -189,7 +189,7 @@ vtkSmartPointer<vtkActor> cylinderActor = vtkSmartPointer<vtkActor>::New(); cylinderActor->SetMapper(cylinderMapper); - [thisView renderer] -> AddActor(cylinderActor); + [thisView renderer]->AddActor(cylinderActor); // Create a text actor. NSString* string = @"日本語"; @@ -205,7 +205,7 @@ vtkCoordinate* coord = textActor->GetPositionCoordinate(); coord->SetCoordinateSystemToWorld(); coord->SetValue(0.3, 0.5, 0.0); - [thisView renderer] -> AddViewProp(textActor); + [thisView renderer]->AddViewProp(textActor); // Tell the system that the view needs to be redrawn [thisView setNeedsDisplay:YES]; diff --git a/Examples/GUI/QML/QtQuickProperty/main.cpp b/Examples/GUI/QML/QtQuickProperty/main.cpp index f3a12cb6d06..3ef0601d650 100644 --- a/Examples/GUI/QML/QtQuickProperty/main.cpp +++ b/Examples/GUI/QML/QtQuickProperty/main.cpp @@ -110,11 +110,13 @@ public: void resetCamera() { - dispatch_async([this](vtkRenderWindow* renderWindow, vtkUserData userData) { - auto* vtk = Data::SafeDownCast(userData); - vtk->renderer->ResetCamera(); - scheduleRender(); - }); + dispatch_async( + [this](vtkRenderWindow* renderWindow, vtkUserData userData) + { + auto* vtk = Data::SafeDownCast(userData); + vtk->renderer->ResetCamera(); + scheduleRender(); + }); } Q_PROPERTY(QString source READ source WRITE setSource NOTIFY sourceChanged) @@ -125,18 +127,20 @@ public: emit sourceChanged((forceVtk = true, _source = v)); if (forceVtk) - dispatch_async([this](vtkRenderWindow* renderWindow, vtkUserData userData) { - auto* vtk = Data::SafeDownCast(userData); - // clang-format off + dispatch_async( + [this](vtkRenderWindow* renderWindow, vtkUserData userData) + { + auto* vtk = Data::SafeDownCast(userData); + // clang-format off vtk->mapper->SetInputConnection( _source == "Cone" ? vtk->cone->GetOutputPort() : _source == "Sphere" ? vtk->sphere->GetOutputPort() : _source == "Capsule" ? vtk->capsule->GetOutputPort() : (qWarning() << Q_FUNC_INFO << "YIKES!! Unknown source:'" << _source << "'", nullptr)); - // clang-format on + // clang-format on - resetCamera(); - }); + resetCamera(); + }); } Q_SIGNAL void sourceChanged(QString); QString _source; diff --git a/Examples/GUI/Qt/CellGridSource/CellGridSource.cxx b/Examples/GUI/Qt/CellGridSource/CellGridSource.cxx index 8fea1bc83f7..2588302e8e0 100644 --- a/Examples/GUI/Qt/CellGridSource/CellGridSource.cxx +++ b/Examples/GUI/Qt/CellGridSource/CellGridSource.cxx @@ -239,33 +239,39 @@ int main(int argc, char* argv[]) QObject::connect(&model, &ArrayGroupModel::dataChanged, [&vtkRenderWidget]() { vtkRenderWidget->renderWindow()->Render(); }); - QObject::connect(&bdyBtn, &QCheckBox::toggled, [&](bool enabled) { - bdyActor->SetVisibility(enabled); - actor->SetVisibility(!enabled); - vtkRenderWidget->renderWindow()->Render(); - }); - - QObject::connect(&glySelector, &QComboBox::currentTextChanged, [&](const QString& text) { - if (text == QString("–none–")) + QObject::connect(&bdyBtn, &QCheckBox::toggled, + [&](bool enabled) { - glyActor->SetVisibility(false); - } - else + bdyActor->SetVisibility(enabled); + actor->SetVisibility(!enabled); + vtkRenderWidget->renderWindow()->Render(); + }); + + QObject::connect(&glySelector, &QComboBox::currentTextChanged, + [&](const QString& text) { - glyActor->SetVisibility(true); - glyMapper->SetOrientationArray(text.toStdString().c_str()); - glyMapper->SetScaleArray(text.toStdString().c_str()); - } - vtkRenderWidget->renderWindow()->Render(); - }); + if (text == QString("–none–")) + { + glyActor->SetVisibility(false); + } + else + { + glyActor->SetVisibility(true); + glyMapper->SetOrientationArray(text.toStdString().c_str()); + glyMapper->SetScaleArray(text.toStdString().c_str()); + } + vtkRenderWidget->renderWindow()->Render(); + }); // connect the buttons - QObject::connect(&cellType, &QComboBox::currentTextChanged, [&](const QString& text) { - cellSource->SetCellType(text.toStdString().c_str()); - updateGlyphSources(cellSource, &glySelector); - updateArrayGroups(model, cellSource, &arrayGroupSelector, true); - vtkRenderWidget->renderWindow()->Render(); - }); + QObject::connect(&cellType, &QComboBox::currentTextChanged, + [&](const QString& text) + { + cellSource->SetCellType(text.toStdString().c_str()); + updateGlyphSources(cellSource, &glySelector); + updateArrayGroups(model, cellSource, &arrayGroupSelector, true); + vtkRenderWidget->renderWindow()->Render(); + }); QObject::connect(&arrayGroupSelector, &QComboBox::currentTextChanged, [&](const QString& text) { model.setGroupName(text.toStdString(), true); }); updateGlyphSources(cellSource, &glySelector); diff --git a/Examples/iOS/GLPaint/Classes/MyGLKViewController.mm b/Examples/iOS/GLPaint/Classes/MyGLKViewController.mm index ea1a4857f86..7aa7da228b3 100644 --- a/Examples/iOS/GLPaint/Classes/MyGLKViewController.mm +++ b/Examples/iOS/GLPaint/Classes/MyGLKViewController.mm @@ -130,7 +130,7 @@ [EAGLContext setCurrentContext:self.context]; [self resizeView]; - [self getVTKRenderWindow] -> Render(); + [self getVTKRenderWindow]->Render(); } - (void)dealloc @@ -174,8 +174,8 @@ - (void)resizeView { double scale = self.view.contentScaleFactor; - [self getVTKRenderWindow] -> SetSize(self.view.bounds.size.width * scale, - self.view.bounds.size.height * scale); + [self getVTKRenderWindow]->SetSize( + self.view.bounds.size.width * scale, self.view.bounds.size.height * scale); } - (void)viewWillLayoutSubviews @@ -185,7 +185,7 @@ - (void)glkView:(GLKView*)view drawInRect:(CGRect)rect { - [self getVTKRenderWindow] -> Render(); + [self getVTKRenderWindow]->Render(); } //================================================================= diff --git a/Examples/iOS/Surfaces/Classes/MyGLKViewController.mm b/Examples/iOS/Surfaces/Classes/MyGLKViewController.mm index 1743031110f..a713e5feafd 100644 --- a/Examples/iOS/Surfaces/Classes/MyGLKViewController.mm +++ b/Examples/iOS/Surfaces/Classes/MyGLKViewController.mm @@ -263,7 +263,7 @@ [EAGLContext setCurrentContext:self.context]; [self resizeView]; - [self getVTKRenderWindow] -> Render(); + [self getVTKRenderWindow]->Render(); } - (void)dealloc @@ -309,7 +309,7 @@ double scale = self.view.contentScaleFactor; double newWidth = scale * self.view.bounds.size.width; double newHeight = scale * self.view.bounds.size.height; - [self getVTKRenderWindow] -> SetSize(newWidth, newHeight); + [self getVTKRenderWindow]->SetSize(newWidth, newHeight); } - (void)viewWillLayoutSubviews @@ -320,7 +320,7 @@ - (void)glkView:(GLKView*)view drawInRect:(CGRect)rect { // std::cout << [self getVTKRenderWindow]->ReportCapabilities() << std::endl; - [self getVTKRenderWindow] -> Render(); + [self getVTKRenderWindow]->Render(); } //================================================================= diff --git a/Examples/iOS/VolumeRender/Classes/MyGLKViewController.mm b/Examples/iOS/VolumeRender/Classes/MyGLKViewController.mm index e9721e6b8b4..2d61b3d5754 100644 --- a/Examples/iOS/VolumeRender/Classes/MyGLKViewController.mm +++ b/Examples/iOS/VolumeRender/Classes/MyGLKViewController.mm @@ -196,7 +196,7 @@ [EAGLContext setCurrentContext:self.context]; [self resizeView]; - [self getVTKRenderWindow] -> Render(); + [self getVTKRenderWindow]->Render(); } - (void)dealloc @@ -242,7 +242,7 @@ double scale = self.view.contentScaleFactor; double newWidth = scale * self.view.bounds.size.width; double newHeight = scale * self.view.bounds.size.height; - [self getVTKRenderWindow] -> SetSize(newWidth, newHeight); + [self getVTKRenderWindow]->SetSize(newWidth, newHeight); } - (void)viewWillLayoutSubviews @@ -253,7 +253,7 @@ - (void)glkView:(GLKView*)view drawInRect:(CGRect)rect { // std::cout << [self getVTKRenderWindow]->ReportCapabilities() << std::endl; - [self getVTKRenderWindow] -> Render(); + [self getVTKRenderWindow]->Render(); } //================================================================= diff --git a/Filters/AMR/Testing/Cxx/TestAMRGhostLayerStripping.cxx b/Filters/AMR/Testing/Cxx/TestAMRGhostLayerStripping.cxx index b13f2470ffe..37df0dfad0b 100644 --- a/Filters/AMR/Testing/Cxx/TestAMRGhostLayerStripping.cxx +++ b/Filters/AMR/Testing/Cxx/TestAMRGhostLayerStripping.cxx @@ -28,7 +28,7 @@ #include "vtkOverlappingAMR.h" #include "vtkPoints.h" #include "vtkUniformGrid.h" -//#define DEBUG_ON +// #define DEBUG_ON //------------------------------------------------------------------------------ // Debugging utilities. Must link vtkIOXML to work diff --git a/Filters/CellGrid/vtkCellGridToUnstructuredGrid.cxx b/Filters/CellGrid/vtkCellGridToUnstructuredGrid.cxx index b22b79ca9d6..b5ce97b0fa1 100644 --- a/Filters/CellGrid/vtkCellGridToUnstructuredGrid.cxx +++ b/Filters/CellGrid/vtkCellGridToUnstructuredGrid.cxx @@ -129,14 +129,16 @@ void vtkCellGridToUnstructuredGrid::Query::StartPass() // Invert the connectivity counts into weights: vtkIdType np = this->ConnectivityCount.rbegin()->first + 1; this->ConnectivityWeights.resize(np, 0.); - vtkSMPTools::For(0, np, [this](vtkIdType begin, vtkIdType end) { - for (vtkIdType ii = begin; ii < end; ++ii) + vtkSMPTools::For(0, np, + [this](vtkIdType begin, vtkIdType end) { - auto it = this->ConnectivityCount.find(ii); - this->ConnectivityWeights[ii] = - (it == this->ConnectivityCount.end() ? 1.0 : 1.0 / it->second); - } - }); + for (vtkIdType ii = begin; ii < end; ++ii) + { + auto it = this->ConnectivityCount.find(ii); + this->ConnectivityWeights[ii] = + (it == this->ConnectivityCount.end() ? 1.0 : 1.0 / it->second); + } + }); this->ConnectivityCount.clear(); } break; diff --git a/Filters/CellGrid/vtkDGCellCenterResponder.cxx b/Filters/CellGrid/vtkDGCellCenterResponder.cxx index b0c4dc8072f..555d10a5e9d 100644 --- a/Filters/CellGrid/vtkDGCellCenterResponder.cxx +++ b/Filters/CellGrid/vtkDGCellCenterResponder.cxx @@ -47,31 +47,35 @@ void addSourceCenters(vtkDGCell* cell, const vtkDGCell::Source& spec, vtkIdTypeA if (spec.SideType < 0) { // Compute center of (non-blanked) cell - vtkSMPTools::For(0, nn, [&](vtkIdType beg, vtkIdType end) { - vtkVector3d param; - for (vtkIdType ii = beg; ii < end; ++ii) + vtkSMPTools::For(0, nn, + [&](vtkIdType beg, vtkIdType end) { - // param = cell->GetParametricCenterOfSide(spec.SideType); - param = cell->GetParametricCenterOfSide(spec.SideType); - cellIds->SetValue(vbegin + ii, ii + off); - rst->SetTuple(vbegin + ii, param.GetData()); - } - }); + vtkVector3d param; + for (vtkIdType ii = beg; ii < end; ++ii) + { + // param = cell->GetParametricCenterOfSide(spec.SideType); + param = cell->GetParametricCenterOfSide(spec.SideType); + cellIds->SetValue(vbegin + ii, ii + off); + rst->SetTuple(vbegin + ii, param.GetData()); + } + }); } else { // Compute center of side of a cell. - vtkSMPTools::For(0, nn, [&](vtkIdType beg, vtkIdType end) { - vtkVector3d param; - std::array<vtkTypeUInt64, 2> sideConn; - for (vtkIdType ii = beg; ii < end; ++ii) + vtkSMPTools::For(0, nn, + [&](vtkIdType beg, vtkIdType end) { - spec.Connectivity->GetUnsignedTuple(ii, sideConn.data()); - param = cell->GetParametricCenterOfSide(sideConn[1]); - cellIds->SetValue(vbegin + ii, ii + off); - rst->SetTuple(vbegin + ii, param.GetData()); - } - }); + vtkVector3d param; + std::array<vtkTypeUInt64, 2> sideConn; + for (vtkIdType ii = beg; ii < end; ++ii) + { + spec.Connectivity->GetUnsignedTuple(ii, sideConn.data()); + param = cell->GetParametricCenterOfSide(sideConn[1]); + cellIds->SetValue(vbegin + ii, ii + off); + rst->SetTuple(vbegin + ii, param.GetData()); + } + }); } vbegin += nn; assert(vbegin <= vend); @@ -170,12 +174,14 @@ void vtkDGCellCenterResponder::AllocateOutputVertices(vtkCellGridCellCenters::Qu vtkNew<vtkIntArray> vconn; vconn->SetNumberOfTuples(nn); vconn->SetName(vcnname.c_str()); - vtkSMPTools::For(0, nn, [&vconn](vtkIdType begin, vtkIdType end) { - for (vtkIdType ii = begin; ii < end; ++ii) + vtkSMPTools::For(0, nn, + [&vconn](vtkIdType begin, vtkIdType end) { - vconn->SetValue(ii, ii); - } - }); + for (vtkIdType ii = begin; ii < end; ++ii) + { + vconn->SetValue(ii, ii); + } + }); auto dgVert = request->GetOutput()->AddCellMetadata<vtkDGVert>(); auto* vtxGroup = request->GetOutput()->GetAttributes("vtkDGVert"_token); vtxGroup->SetScalars(vconn); diff --git a/Filters/CellGrid/vtkDGCellSourceResponder.cxx b/Filters/CellGrid/vtkDGCellSourceResponder.cxx index a9285edfbc8..ff61189ffd5 100644 --- a/Filters/CellGrid/vtkDGCellSourceResponder.cxx +++ b/Filters/CellGrid/vtkDGCellSourceResponder.cxx @@ -145,8 +145,9 @@ void vtkDGCellSourceResponder::CreateCellAttribute(vtkDGCell* dgCell, vtkStringT dofSharing.IsValid() ? numberOfComponents / basisSize : numberOfValues); attribVals->SetNumberOfTuples( dofSharing.IsValid() ? numberOfValues * basisSize / numberOfComponents : 1); - vtkSMPTools::For( - 0, attribVals->GetNumberOfValues(), [&attribVals](vtkIdType begin, vtkIdType end) { + vtkSMPTools::For(0, attribVals->GetNumberOfValues(), + [&attribVals](vtkIdType begin, vtkIdType end) + { for (vtkIdType ii = begin; ii < end; ++ii) { attribVals->SetValue(ii, ii == 0 ? 1. : 0.); diff --git a/Filters/CellGrid/vtkDGElevationResponder.cxx b/Filters/CellGrid/vtkDGElevationResponder.cxx index 16675060779..e2f7847cf42 100644 --- a/Filters/CellGrid/vtkDGElevationResponder.cxx +++ b/Filters/CellGrid/vtkDGElevationResponder.cxx @@ -90,7 +90,8 @@ bool vtkDGElevationResponder::Query( evaluateElevation = [&](const vtkVector3d& pt) { return (pt - origin).Dot(axis); }; break; case 2: - evaluateElevation = [&](const vtkVector3d& pt) { + evaluateElevation = [&](const vtkVector3d& pt) + { double dist = (pt - origin).Dot(axis); return (pt - (origin + dist * axis)).Norm(); }; diff --git a/Filters/CellGrid/vtkDGEvaluator.cxx b/Filters/CellGrid/vtkDGEvaluator.cxx index 1a053f114d8..00d7383bea5 100644 --- a/Filters/CellGrid/vtkDGEvaluator.cxx +++ b/Filters/CellGrid/vtkDGEvaluator.cxx @@ -217,7 +217,8 @@ bool vtkDGEvaluator::ClassifyPoints( cellConn.resize(numCorners); cellCorners.resize(numCorners); auto classifier = [&](vtkTypeUInt64 cellId, const vtkVector3d& testPoint, - const std::vector<vtkVector3d>& cellCornerData) { + const std::vector<vtkVector3d>& cellCornerData) + { (void)cellId; // Loop over sides of dimension (dim - 1), testing its halfspace. int numSideTypes = dgCell->GetNumberOfSideTypes(); @@ -423,19 +424,21 @@ bool vtkDGEvaluator::InterpolatePoints( vtkIdType numberOfPoints = alloc.GetNumberOfOutputPoints(); // The number of points to process. const vtkIdType end = outputPointId + numberOfPoints; - vtkSMPTools::For(outputPointId, end, [&](vtkIdType bid, vtkIdType eid) { - vtkTypeUInt64 cellId; - vtkVector3d rst; - std::vector<double> value; - value.resize(attribute->GetNumberOfComponents()); - for (vtkIdType ii = bid; ii < eid; ++ii) + vtkSMPTools::For(outputPointId, end, + [&](vtkIdType bid, vtkIdType eid) { - cellIds->GetTypedTuple(ii, &cellId); - pointParams->GetTuple(ii, rst.GetData()); - calc->Evaluate(cellId, rst, value); - values->SetTuple(ii, value.data()); - } - }); + vtkTypeUInt64 cellId; + vtkVector3d rst; + std::vector<double> value; + value.resize(attribute->GetNumberOfComponents()); + for (vtkIdType ii = bid; ii < eid; ++ii) + { + cellIds->GetTypedTuple(ii, &cellId); + pointParams->GetTuple(ii, rst.GetData()); + calc->Evaluate(cellId, rst, value); + values->SetTuple(ii, value.data()); + } + }); return true; } diff --git a/Filters/CellGrid/vtkDGOperationEvaluator.h b/Filters/CellGrid/vtkDGOperationEvaluator.h index 005359c2288..9af42a95317 100644 --- a/Filters/CellGrid/vtkDGOperationEvaluator.h +++ b/Filters/CellGrid/vtkDGOperationEvaluator.h @@ -433,7 +433,8 @@ public: OutputIterator, DOFSharing, SourceType, Modifier, ShapeSharing>( op, conn, values, sides, offset, shapeGradient, shapeConnectivity, shapeValues)); entry.Function = [&entry](InputIterator& inIter, OutputIterator& outIter, vtkTypeUInt64 begin, - vtkTypeUInt64 end) { + vtkTypeUInt64 end) + { auto* eval = reinterpret_cast<vtkDGOperationEvaluator<InputIterator, OutputIterator, DOFSharing, SourceType, Modifier, ShapeSharing>*>(entry.State.get()); return (*eval)(inIter, outIter, begin, end); diff --git a/Filters/CellGrid/vtkDGTranscribeCellGridCells.cxx b/Filters/CellGrid/vtkDGTranscribeCellGridCells.cxx index b4a36ae2018..4da4c876347 100644 --- a/Filters/CellGrid/vtkDGTranscribeCellGridCells.cxx +++ b/Filters/CellGrid/vtkDGTranscribeCellGridCells.cxx @@ -337,22 +337,24 @@ void vtkDGTranscribeCellGridCells::GeneratePointData( interpResult->SetNumberOfComponents(nc); interpResult->SetNumberOfTuples(nn); dgCalc->Evaluate(contribs.InputCellIds, contribs.ParametricCoords, interpResult); - vtkSMPTools::For(0, nn, [&](vtkIdType begin, vtkIdType end) { - std::vector<double> outTuple(nc, 0.); - std::vector<double> inTuple(nc, 0.); - for (vtkIdType ii = begin; ii < end; ++ii) + vtkSMPTools::For(0, nn, + [&](vtkIdType begin, vtkIdType end) { - interpResult->GetTuple(ii, inTuple.data()); - vtkIdType outputPointId = contribs.OutputPointIds->GetValue(ii); - outputArray->GetTuple(outputPointId, outTuple.data()); - double pw = pointWeights[outputPointId]; - for (int jj = 0; jj < nc; ++jj) + std::vector<double> outTuple(nc, 0.); + std::vector<double> inTuple(nc, 0.); + for (vtkIdType ii = begin; ii < end; ++ii) { - outTuple[jj] += pw * inTuple[jj]; + interpResult->GetTuple(ii, inTuple.data()); + vtkIdType outputPointId = contribs.OutputPointIds->GetValue(ii); + outputArray->GetTuple(outputPointId, outTuple.data()); + double pw = pointWeights[outputPointId]; + for (int jj = 0; jj < nc; ++jj) + { + outTuple[jj] += pw * inTuple[jj]; + } + outputArray->SetTuple(outputPointId, outTuple.data()); } - outputArray->SetTuple(outputPointId, outTuple.data()); - } - }); + }); } FreePointContributionCache(request, cellType, caches); } diff --git a/Filters/CellGrid/vtkDGTransformResponder.cxx b/Filters/CellGrid/vtkDGTransformResponder.cxx index 29e82c01f87..5adbfa06d28 100644 --- a/Filters/CellGrid/vtkDGTransformResponder.cxx +++ b/Filters/CellGrid/vtkDGTransformResponder.cxx @@ -86,15 +86,17 @@ bool vtkDGTransformResponder::Query( // loses precision; always use TransformPoint(double*, double*). if (dofSharing) { - vtkSMPTools::For(0, nt, [&](vtkIdType begin, vtkIdType end) { - for (vtkIdType ii = begin; ii < end; ++ii) + vtkSMPTools::For(0, nt, + [&](vtkIdType begin, vtkIdType end) { - std::array<double, 3> tuple; - values->GetTuple(ii, tuple.data()); - xfm->TransformPoint(tuple.data(), tuple.data()); - transformedValues->SetTuple(ii, tuple.data()); - } - }); + for (vtkIdType ii = begin; ii < end; ++ii) + { + std::array<double, 3> tuple; + values->GetTuple(ii, tuple.data()); + xfm->TransformPoint(tuple.data(), tuple.data()); + transformedValues->SetTuple(ii, tuple.data()); + } + }); auto* arrayGroup = cellType->GetCellGrid()->GetAttributes(cellTypeInfo.DOFSharing); arrayGroup->RemoveArray(values->GetName()); arrayGroup->AddArray(transformedValues); @@ -106,19 +108,21 @@ bool vtkDGTransformResponder::Query( cellTypeInfo.FunctionSpace == "constant"_token) { // DG HGRAD data repeats a vector value once for each basis - vtkSMPTools::For(0, nt, [&](vtkIdType begin, vtkIdType end) { - std::vector<double> tuple; - tuple.resize(values->GetNumberOfComponents()); - for (vtkIdType ii = begin; ii < end; ++ii) + vtkSMPTools::For(0, nt, + [&](vtkIdType begin, vtkIdType end) { - values->GetTuple(ii, tuple.data()); - for (int jj = 0; jj < nvpt; ++jj) + std::vector<double> tuple; + tuple.resize(values->GetNumberOfComponents()); + for (vtkIdType ii = begin; ii < end; ++ii) { - xfm->TransformPoint(tuple.data() + 3 * jj, tuple.data() + 3 * jj); + values->GetTuple(ii, tuple.data()); + for (int jj = 0; jj < nvpt; ++jj) + { + xfm->TransformPoint(tuple.data() + 3 * jj, tuple.data() + 3 * jj); + } + transformedValues->SetTuple(ii, tuple.data()); } - transformedValues->SetTuple(ii, tuple.data()); - } - }); + }); auto* arrayGroup = cellType->GetCellGrid()->GetAttributes(cellTypeToken); arrayGroup->RemoveArray(values->GetName()); arrayGroup->AddArray(transformedValues); diff --git a/Filters/CellGrid/vtkDGWarp.cxx b/Filters/CellGrid/vtkDGWarp.cxx index afa88c05b38..4a139851689 100644 --- a/Filters/CellGrid/vtkDGWarp.cxx +++ b/Filters/CellGrid/vtkDGWarp.cxx @@ -131,20 +131,22 @@ bool vtkDGWarp::Query( auto* outPts = pts->NewInstance(); outPts->DeepCopy(pts); - vtkSMPTools::For(0, outPts->GetNumberOfTuples(), [&](vtkIdType begin, vtkIdType end) { - std::array<double, 3> xx; - std::array<double, 3> dd; - for (vtkIdType ii = begin; ii < end; ++ii) + vtkSMPTools::For(0, outPts->GetNumberOfTuples(), + [&](vtkIdType begin, vtkIdType end) { - pts->GetTuple(ii, xx.data()); - defl->GetTuple(ii, dd.data()); - for (int jj = 0; jj < 3; ++jj) + std::array<double, 3> xx; + std::array<double, 3> dd; + for (vtkIdType ii = begin; ii < end; ++ii) { - xx[jj] += request->GetScaleFactor() * dd[jj]; + pts->GetTuple(ii, xx.data()); + defl->GetTuple(ii, dd.data()); + for (int jj = 0; jj < 3; ++jj) + { + xx[jj] += request->GetScaleFactor() * dd[jj]; + } + outPts->SetTuple(ii, xx.data()); } - outPts->SetTuple(ii, xx.data()); - } - }); + }); grid->GetAttributes(shapeInfo.DOFSharing)->RemoveArray(pts->GetName()); grid->GetAttributes(shapeInfo.DOFSharing)->AddArray(outPts); shapeArrays["values"_token] = outPts; diff --git a/Filters/Core/Testing/Cxx/TestAttributeDataToTableHyperTreeGrid.cxx b/Filters/Core/Testing/Cxx/TestAttributeDataToTableHyperTreeGrid.cxx index bdaf713fe0e..cafa2af8dcd 100644 --- a/Filters/Core/Testing/Cxx/TestAttributeDataToTableHyperTreeGrid.cxx +++ b/Filters/Core/Testing/Cxx/TestAttributeDataToTableHyperTreeGrid.cxx @@ -56,7 +56,8 @@ int TestAttributeDataToTableHyperTreeGrid(int vtkNotUsed(argc), char* vtkNotUsed return EXIT_FAILURE; } - auto checkIota = [](vtkDataArray* arr) { + auto checkIota = [](vtkDataArray* arr) + { if (!arr) { return false; diff --git a/Filters/Core/Testing/Cxx/TestConnectivityFilter.cxx b/Filters/Core/Testing/Cxx/TestConnectivityFilter.cxx index fb51c60a43e..0af3eaba10f 100644 --- a/Filters/Core/Testing/Cxx/TestConnectivityFilter.cxx +++ b/Filters/Core/Testing/Cxx/TestConnectivityFilter.cxx @@ -61,9 +61,9 @@ bool CheckOutputPointsType(vtkUnstructuredGrid* output, int inputType, int expec vtkPoints* points = output->GetPoints(); int outputDataType = points->GetDataType(); - int expectedType = expectedPrecision == vtkAlgorithm::DEFAULT_PRECISION - ? inputType - : expectedPrecision == vtkAlgorithm::SINGLE_PRECISION ? VTK_FLOAT : VTK_DOUBLE; + int expectedType = expectedPrecision == vtkAlgorithm::DEFAULT_PRECISION ? inputType + : expectedPrecision == vtkAlgorithm::SINGLE_PRECISION ? VTK_FLOAT + : VTK_DOUBLE; if (expectedType != outputDataType) { diff --git a/Filters/Core/Testing/Cxx/TestDelaunay2D.cxx b/Filters/Core/Testing/Cxx/TestDelaunay2D.cxx index a21b3ccfb8c..e895e88d734 100644 --- a/Filters/Core/Testing/Cxx/TestDelaunay2D.cxx +++ b/Filters/Core/Testing/Cxx/TestDelaunay2D.cxx @@ -17,7 +17,7 @@ #include "vtkRenderer.h" #include "vtkShrinkPolyData.h" -//#define WRITE_IMAGE +// #define WRITE_IMAGE #ifdef WRITE_IMAGE #include "vtkPNGWriter.h" diff --git a/Filters/Core/Testing/Cxx/TestDelaunay2DBestFittingPlane.cxx b/Filters/Core/Testing/Cxx/TestDelaunay2DBestFittingPlane.cxx index eb03a5ccac9..019bc15cb30 100644 --- a/Filters/Core/Testing/Cxx/TestDelaunay2DBestFittingPlane.cxx +++ b/Filters/Core/Testing/Cxx/TestDelaunay2DBestFittingPlane.cxx @@ -20,7 +20,7 @@ #include "vtkRenderer.h" #include "vtkShrinkPolyData.h" -//#define WRITE_IMAGE +// #define WRITE_IMAGE #ifdef WRITE_IMAGE #include "vtkPNGWriter.h" diff --git a/Filters/Core/vtkAppendPartitionedDataSetCollection.cxx b/Filters/Core/vtkAppendPartitionedDataSetCollection.cxx index ee13070712c..fff4e7c4764 100644 --- a/Filters/Core/vtkAppendPartitionedDataSetCollection.cxx +++ b/Filters/Core/vtkAppendPartitionedDataSetCollection.cxx @@ -188,7 +188,8 @@ int vtkAppendPartitionedDataSetCollection::RequestData(vtkInformation* vtkNotUse { // append the field data auto appendFieldData = [](std::vector<vtkDataObject*> inputDOs, - vtkDataObject* outputDO) -> void { + vtkDataObject* outputDO) -> void + { auto outputFD = outputDO->GetFieldData(); for (auto inputDO : inputDOs) { diff --git a/Filters/Core/vtkAttributeDataToTableFilter.cxx b/Filters/Core/vtkAttributeDataToTableFilter.cxx index 996c88b6012..797a3d6b1bb 100644 --- a/Filters/Core/vtkAttributeDataToTableFilter.cxx +++ b/Filters/Core/vtkAttributeDataToTableFilter.cxx @@ -156,12 +156,14 @@ void vtkAttributeDataToTableFilter::AddCellTypeAndConnectivity(vtkTable* output, // for thread safety after ds->GetCellType(0); } - vtkSMPTools::For(0, numcells, [&ds, &celltypes](vtkIdType begin, vtkIdType end) { - for (auto idx = begin; idx < end; ++idx) + vtkSMPTools::For(0, numcells, + [&ds, &celltypes](vtkIdType begin, vtkIdType end) { - celltypes->SetValue(idx, static_cast<char>(ds->GetCellType(idx))); - } - }); + for (auto idx = begin; idx < end; ++idx) + { + celltypes->SetValue(idx, static_cast<char>(ds->GetCellType(idx))); + } + }); output->GetRowData()->AddArray(celltypes); vtkIdType maxpoints = 0; { @@ -186,23 +188,25 @@ void vtkAttributeDataToTableFilter::AddCellTypeAndConnectivity(vtkTable* output, } vtkSMPThreadLocalObject<vtkIdList> locPoints; - vtkSMPTools::For(0, numcells, [&](vtkIdType begin, vtkIdType end) { - for (vtkIdType cc = begin; cc < end; cc++) + vtkSMPTools::For(0, numcells, + [&](vtkIdType begin, vtkIdType end) { - ds->GetCellPoints(cc, locPoints.Local()); - for (vtkIdType pt = 0; pt < maxpoints; pt++) + for (vtkIdType cc = begin; cc < end; cc++) { - if (pt < locPoints.Local()->GetNumberOfIds()) - { - indices[pt]->SetValue(cc, locPoints.Local()->GetId(pt)); - } - else + ds->GetCellPoints(cc, locPoints.Local()); + for (vtkIdType pt = 0; pt < maxpoints; pt++) { - indices[pt]->SetValue(cc, -1); + if (pt < locPoints.Local()->GetNumberOfIds()) + { + indices[pt]->SetValue(cc, locPoints.Local()->GetId(pt)); + } + else + { + indices[pt]->SetValue(cc, -1); + } } } - } - }); + }); for (int i = 0; i < maxpoints; i++) { this->ConvertToOriginalIds(ds, indices[i]); @@ -250,8 +254,9 @@ void vtkAttributeDataToTableFilter::PassFieldData(vtkFieldData* output, vtkField if (da != nullptr && num_comps > 0) { std::vector<double> tuple(num_comps, 0.0); - vtkSMPTools::For( - current_count, max_count, [&da, &maskArray, &tuple](vtkIdType begin, vtkIdType end) { + vtkSMPTools::For(current_count, max_count, + [&da, &maskArray, &tuple](vtkIdType begin, vtkIdType end) + { for (auto idx = begin; idx < end; ++idx) { da->SetTuple(idx, tuple.data()); @@ -332,12 +337,14 @@ void vtkAttributeDataToTableFilter::Decorate(vtkTable* output, vtkDataObject* in indicesArray->SetNumberOfComponents(1); vtkIdType numElements = input->GetNumberOfElements(this->FieldAssociation); indicesArray->SetNumberOfTuples(numElements); - vtkSMPTools::For(0, numElements, [&indicesArray](vtkIdType begin, vtkIdType end) { - for (vtkIdType idx = begin; idx < end; ++idx) + vtkSMPTools::For(0, numElements, + [&indicesArray](vtkIdType begin, vtkIdType end) { - indicesArray->SetValue(idx, idx); - } - }); + for (vtkIdType idx = begin; idx < end; ++idx) + { + indicesArray->SetValue(idx, idx); + } + }); output->GetRowData()->AddArray(indicesArray); indicesArray->FastDelete(); } @@ -362,8 +369,9 @@ void vtkAttributeDataToTableFilter::ConvertToOriginalIds( { auto indexRange = vtk::DataArrayValueRange<1>(indices); auto originalRange = vtk::DataArrayValueRange<1>(originalIds); - vtkSMPTools::Transform( - indexRange.begin(), indexRange.end(), indexRange.begin(), [&originalRange](vtkIdType idx) { + vtkSMPTools::Transform(indexRange.begin(), indexRange.end(), indexRange.begin(), + [&originalRange](vtkIdType idx) + { if (idx >= 0 && idx < originalRange.size()) { return static_cast<vtkIdType>(originalRange[idx]); diff --git a/Filters/Core/vtkCellDataToPointData.cxx b/Filters/Core/vtkCellDataToPointData.cxx index 956e44e263e..f14ee561845 100644 --- a/Filters/Core/vtkCellDataToPointData.cxx +++ b/Filters/Core/vtkCellDataToPointData.cxx @@ -682,7 +682,8 @@ int vtkCellDataToPointData::RequestDataForUnstructuredData( const auto nfields = processedCellData->GetNumberOfArrays(); int fid = 0; auto f = [this, &fid, nfields, numberOfPoints, input, num, numberOfCells, highestCellDimension]( - vtkAbstractArray* aa_srcarray, vtkAbstractArray* aa_dstarray) { + vtkAbstractArray* aa_srcarray, vtkAbstractArray* aa_dstarray) + { // update progress and check for an abort request. this->UpdateProgress((fid + 1.0) / nfields); ++fid; diff --git a/Filters/Core/vtkConstrainedSmoothingFilter.cxx b/Filters/Core/vtkConstrainedSmoothingFilter.cxx index 26c89cade29..47e588506bb 100644 --- a/Filters/Core/vtkConstrainedSmoothingFilter.cxx +++ b/Filters/Core/vtkConstrainedSmoothingFilter.cxx @@ -379,7 +379,8 @@ struct AttrWorker // In place lambda to compute error scalars and vectors vtkSMPTools::For(0, numPts, - [&inPtsArray, &outPtsArray, &scalars, &vectors](vtkIdType ptId, vtkIdType endPtId) { + [&inPtsArray, &outPtsArray, &scalars, &vectors](vtkIdType ptId, vtkIdType endPtId) + { const auto inPts = vtk::DataArrayTupleRange<3>(inPtsArray); const auto outPts = vtk::DataArrayTupleRange<3>(outPtsArray); diff --git a/Filters/Core/vtkCutter.cxx b/Filters/Core/vtkCutter.cxx index 3793fb029b0..811befdfd05 100644 --- a/Filters/Core/vtkCutter.cxx +++ b/Filters/Core/vtkCutter.cxx @@ -312,7 +312,8 @@ int vtkCutter::RequestData( } vtkPlane* plane = vtkPlane::SafeDownCast(this->CutFunction); - auto executePlaneCutter = [&]() { + auto executePlaneCutter = [&]() + { if (this->Locator == nullptr) { this->CreateDefaultLocator(); diff --git a/Filters/Core/vtkDataSetToDataObjectFilter.cxx b/Filters/Core/vtkDataSetToDataObjectFilter.cxx index 3b16c69712a..270cab8def1 100644 --- a/Filters/Core/vtkDataSetToDataObjectFilter.cxx +++ b/Filters/Core/vtkDataSetToDataObjectFilter.cxx @@ -149,7 +149,8 @@ int vtkDataSetToDataObjectFilter::RequestData( if (this->Topology) { // Helper lambda to add cell arrays to the field data: - auto addCellConnArrays = [&](vtkCellArray* ca, const std::string& name) { + auto addCellConnArrays = [&](vtkCellArray* ca, const std::string& name) + { if (!ca || ca->GetNumberOfCells() == 0) { return; diff --git a/Filters/Core/vtkExtractCells.cxx b/Filters/Core/vtkExtractCells.cxx index f191892af98..78182694feb 100644 --- a/Filters/Core/vtkExtractCells.cxx +++ b/Filters/Core/vtkExtractCells.cxx @@ -88,20 +88,22 @@ struct ExtractPointsWorker void operator()( TInputPoints* inputPoints, TOutputPoints* outputPoints, const PointWorkT& pointWork) { - vtkSMPTools::For(0, pointWork.GetNumberOfPoints(), [&](vtkIdType begin, vtkIdType end) { - const auto inPts = vtk::DataArrayTupleRange<3>(inputPoints); - auto outPts = vtk::DataArrayTupleRange<3>(outputPoints); - double point[3]; - for (vtkIdType ptId = begin; ptId < end; ++ptId) + vtkSMPTools::For(0, pointWork.GetNumberOfPoints(), + [&](vtkIdType begin, vtkIdType end) { - const vtkIdType origPtId = pointWork.GetPointId(ptId); - // GetTuple creates a copy of the tuple using GetTypedTuple if it's not a vktDataArray - // we do that since the input points can be implicit points, and GetTypedTuple is faster - // than accessing the component of the TupleReference using GetTypedComponent internally. - inPts.GetTuple(origPtId, point); - outPts.SetTuple(ptId, point); - } - }); + const auto inPts = vtk::DataArrayTupleRange<3>(inputPoints); + auto outPts = vtk::DataArrayTupleRange<3>(outputPoints); + double point[3]; + for (vtkIdType ptId = begin; ptId < end; ++ptId) + { + const vtkIdType origPtId = pointWork.GetPointId(ptId); + // GetTuple creates a copy of the tuple using GetTypedTuple if it's not a vktDataArray + // we do that since the input points can be implicit points, and GetTypedTuple is faster + // than accessing the component of the TupleReference using GetTypedComponent internally. + inPts.GetTuple(origPtId, point); + outPts.SetTuple(ptId, point); + } + }); } }; @@ -168,12 +170,14 @@ void AddOriginalCellIds(vtkCellData* outCD, const CellWorkT& work) vtkNew<vtkIdTypeArray> ids; ids->SetName("vtkOriginalCellIds"); ids->SetNumberOfValues(numCells); - vtkSMPTools::For(0, numCells, [&ids, &work](vtkIdType start, vtkIdType end) { - for (vtkIdType cc = start; cc < end; ++cc) + vtkSMPTools::For(0, numCells, + [&ids, &work](vtkIdType start, vtkIdType end) { - ids->SetValue(cc, work.GetCellId(cc)); - } - }); + for (vtkIdType cc = start; cc < end; ++cc) + { + ids->SetValue(cc, work.GetCellId(cc)); + } + }); outCD->AddArray(ids); } } @@ -227,12 +231,14 @@ ExtractedCellsT ExtractCells(vtkDataSet* input, const CellWorkT& work, unsigned input->GetCell(0); // set cell types - vtkSMPTools::For(0, outputNumCells, [&](vtkIdType begin, vtkIdType end) { - for (vtkIdType cc = begin; cc < end; ++cc) + vtkSMPTools::For(0, outputNumCells, + [&](vtkIdType begin, vtkIdType end) { - result.CellTypes->SetValue(cc, input->GetCellType(work.GetCellId(cc))); - } - }); + for (vtkIdType cc = begin; cc < end; ++cc) + { + result.CellTypes->SetValue(cc, input->GetCellType(work.GetCellId(cc))); + } + }); // initialize batches ExtractCellsBatches batches; @@ -240,22 +246,24 @@ ExtractedCellsT ExtractCells(vtkDataSet* input, const CellWorkT& work, unsigned // figure out the connectivity size and the begin values for each batch vtkSMPThreadLocalObject<vtkIdList> TLCellPointIds; - vtkSMPTools::For(0, batches.GetNumberOfBatches(), [&](vtkIdType begin, vtkIdType end) { - vtkIdType numCellPts, cellId, cellIndex; - const vtkIdType* cellPts; - auto& cellPointIds = TLCellPointIds.Local(); - for (vtkIdType batchId = begin; batchId < end; ++batchId) + vtkSMPTools::For(0, batches.GetNumberOfBatches(), + [&](vtkIdType begin, vtkIdType end) { - ExtractCellsBatch& batch = batches[batchId]; - auto& cellsConnectivity = batch.Data.CellsConnectivityOffset; - for (cellIndex = batch.BeginId; cellIndex < batch.EndId; ++cellIndex) + vtkIdType numCellPts, cellId, cellIndex; + const vtkIdType* cellPts; + auto& cellPointIds = TLCellPointIds.Local(); + for (vtkIdType batchId = begin; batchId < end; ++batchId) { - cellId = work.GetCellId(cellIndex); - input->GetCellPoints(cellId, numCellPts, cellPts, cellPointIds); - cellsConnectivity += numCellPts; + ExtractCellsBatch& batch = batches[batchId]; + auto& cellsConnectivity = batch.Data.CellsConnectivityOffset; + for (cellIndex = batch.BeginId; cellIndex < batch.EndId; ++cellIndex) + { + cellId = work.GetCellId(cellIndex); + input->GetCellPoints(cellId, numCellPts, cellPts, cellPointIds); + cellsConnectivity += numCellPts; + } } - } - }); + }); // assign BeginCellsConnectivity and calculate connectivity size const auto globalSum = batches.BuildOffsetsAndGetGlobalSum(); const auto totalConnectivitySize = globalSum.CellsConnectivityOffset; @@ -266,26 +274,28 @@ ExtractedCellsT ExtractCells(vtkDataSet* input, const CellWorkT& work, unsigned // set cell array offsets vtkNew<vtkIdTypeArray> offsets; offsets->SetNumberOfValues(outputNumCells + 1); - vtkSMPTools::For(0, batches.GetNumberOfBatches(), [&](vtkIdType begin, vtkIdType end) { - vtkIdType numCellPts, cellId, cellIndex, ptId; - const vtkIdType* cellPts; - auto& cellPointIds = TLCellPointIds.Local(); - for (vtkIdType batchId = begin; batchId < end; ++batchId) + vtkSMPTools::For(0, batches.GetNumberOfBatches(), + [&](vtkIdType begin, vtkIdType end) { - ExtractCellsBatch& batch = batches[batchId]; - auto cellsConnectivityOffset = batch.Data.CellsConnectivityOffset; - for (cellIndex = batch.BeginId; cellIndex < batch.EndId; ++cellIndex) + vtkIdType numCellPts, cellId, cellIndex, ptId; + const vtkIdType* cellPts; + auto& cellPointIds = TLCellPointIds.Local(); + for (vtkIdType batchId = begin; batchId < end; ++batchId) { - cellId = work.GetCellId(cellIndex); - input->GetCellPoints(cellId, numCellPts, cellPts, cellPointIds); - offsets->SetValue(cellIndex, cellsConnectivityOffset); - for (ptId = 0; ptId < numCellPts; ++ptId) + ExtractCellsBatch& batch = batches[batchId]; + auto cellsConnectivityOffset = batch.Data.CellsConnectivityOffset; + for (cellIndex = batch.BeginId; cellIndex < batch.EndId; ++cellIndex) { - connectivity->SetValue(cellsConnectivityOffset++, work.GetPointId(cellPts[ptId])); + cellId = work.GetCellId(cellIndex); + input->GetCellPoints(cellId, numCellPts, cellPts, cellPointIds); + offsets->SetValue(cellIndex, cellsConnectivityOffset); + for (ptId = 0; ptId < numCellPts; ++ptId) + { + connectivity->SetValue(cellsConnectivityOffset++, work.GetPointId(cellPts[ptId])); + } } } - } - }); + }); // set last offset offsets->SetValue(outputNumCells, totalConnectivitySize); // set cell array @@ -361,19 +371,22 @@ void ExtractPolyhedralFaces( offsetsPolyFaces->SetValue(face + 1, facePos); } // Now copy polyhedron Faces. - vtkSMPTools::For(0, outFaceLocSize, [&](vtkIdType start, vtkIdType end) { - vtkNew<vtkIdList> facePts; - for (vtkIdType cc = start; cc < end; ++cc) + vtkSMPTools::For(0, outFaceLocSize, + [&](vtkIdType start, vtkIdType end) { - vtkIdType npts; - const vtkIdType* pts; - vtkIdType faceId = connectivityPoly->GetValue(cc); - inFaces->GetCellAtId(faceId, npts, pts, facePts); - const auto loc = offsetsPolyFaces->GetValue(cc); - auto optr = connectivityPolyFaces->GetPointer(loc); - std::transform(pts, pts + npts, optr, [&work](vtkIdType id) { return work.GetPointId(id); }); - } - }); + vtkNew<vtkIdList> facePts; + for (vtkIdType cc = start; cc < end; ++cc) + { + vtkIdType npts; + const vtkIdType* pts; + vtkIdType faceId = connectivityPoly->GetValue(cc); + inFaces->GetCellAtId(faceId, npts, pts, facePts); + const auto loc = offsetsPolyFaces->GetValue(cc); + auto optr = connectivityPolyFaces->GetPointer(loc); + std::transform( + pts, pts + npts, optr, [&work](vtkIdType id) { return work.GetPointId(id); }); + } + }); // Finalize the mapping to local faces facePos = 0; for (vtkIdType face = 0; face < outFaceLocSize; ++face) @@ -401,20 +414,22 @@ vtkSmartPointer<vtkIdList> GeneratePointMap( input->GetCell(0); auto pointMapPtr = pointMap->GetPointer(0); - vtkSMPTools::For(0, numberOutputCells, [&](vtkIdType begin, vtkIdType end) { - vtkIdType npts, cellId; - const vtkIdType* ptids; - auto& cellPointIds = TLCellPointIds.Local(); - for (vtkIdType cellIndex = begin; cellIndex < end; ++cellIndex) + vtkSMPTools::For(0, numberOutputCells, + [&](vtkIdType begin, vtkIdType end) { - cellId = cellList->GetId(cellIndex); - input->GetCellPoints(cellId, npts, ptids, cellPointIds); - for (vtkIdType i = 0; i < npts; ++i) + vtkIdType npts, cellId; + const vtkIdType* ptids; + auto& cellPointIds = TLCellPointIds.Local(); + for (vtkIdType cellIndex = begin; cellIndex < end; ++cellIndex) { - pointMapPtr[ptids[i]] = 1; + cellId = cellList->GetId(cellIndex); + input->GetCellPoints(cellId, npts, ptids, cellPointIds); + for (vtkIdType i = 0; i < npts; ++i) + { + pointMapPtr[ptids[i]] = 1; + } } - } - }); + }); // convert flags to map where index is old id, value is new id and -1 means // the point is to be discarded. vtkIdType nextid = 0; @@ -561,9 +576,9 @@ void vtkExtractCells::AddCellIds(const vtkIdType* ptr, vtkIdType numValues) cellIds->Resize(newSize); } cellIds->SetNumberOfIds(newSize); - vtkSMPTools::For(0, numValues, [&](vtkIdType begin, vtkIdType end) { - std::copy(ptr + begin, ptr + end, cellIds->GetPointer(oldSize + begin)); - }); + vtkSMPTools::For(0, numValues, + [&](vtkIdType begin, vtkIdType end) + { std::copy(ptr + begin, ptr + end, cellIds->GetPointer(oldSize + begin)); }); this->Modified(); } @@ -589,10 +604,12 @@ void vtkExtractCells::AddCellRange(vtkIdType from, vtkIdType to) cellIds->Resize(newSize); } cellIds->SetNumberOfIds(newSize); - vtkSMPTools::For(0, numValues, [&](vtkIdType begin, vtkIdType end) { - std::iota( - cellIds->GetPointer(oldSize + begin), cellIds->GetPointer(oldSize + end), from + begin); - }); + vtkSMPTools::For(0, numValues, + [&](vtkIdType begin, vtkIdType end) + { + std::iota( + cellIds->GetPointer(oldSize + begin), cellIds->GetPointer(oldSize + end), from + begin); + }); this->Modified(); } diff --git a/Filters/Core/vtkExtractEdges.cxx b/Filters/Core/vtkExtractEdges.cxx index 47deaf6276e..bd093ea1422 100644 --- a/Filters/Core/vtkExtractEdges.cxx +++ b/Filters/Core/vtkExtractEdges.cxx @@ -95,7 +95,8 @@ struct ExtractEdges // In place lambda to do the threaded copying of edges vtkSMPTools::For(0, totalEdges, - [&edgeOffsets, &edges, offsetsPtr, connPtr](vtkIdType edgeId, vtkIdType endEdgeId) { + [&edgeOffsets, &edges, offsetsPtr, connPtr](vtkIdType edgeId, vtkIdType endEdgeId) + { for (; edgeId < endEdgeId; ++edgeId) { vtkIdType* c = connPtr + 2 * edgeId; @@ -120,8 +121,9 @@ struct ExtractEdges cellArrays.AddArrays( totalEdges, this->InCD, this->OutCD, /*nullValue*/ 0.0, /*promote*/ false); - vtkSMPTools::For( - 0, totalEdges, [&edgeOffsets, &edges, &cellArrays](vtkIdType edgeId, vtkIdType endEdgeId) { + vtkSMPTools::For(0, totalEdges, + [&edgeOffsets, &edges, &cellArrays](vtkIdType edgeId, vtkIdType endEdgeId) + { for (; edgeId < endEdgeId; ++edgeId) { vtkIdType numEdges = edgeOffsets[edgeId + 1] - edgeOffsets[edgeId]; @@ -340,14 +342,16 @@ int NonLocatorExtraction( newPts->SetNumberOfPoints(numPts); output->SetPoints(newPts); - vtkSMPTools::For(0, numPts, [&input, &newPts](vtkIdType ptId, vtkIdType endPtId) { - double pnt[3]; - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, numPts, + [&input, &newPts](vtkIdType ptId, vtkIdType endPtId) { - input->GetPoint(ptId, pnt); - newPts->SetPoint(ptId, pnt); - } - }); + double pnt[3]; + for (; ptId < endPtId; ++ptId) + { + input->GetPoint(ptId, pnt); + newPts->SetPoint(ptId, pnt); + } + }); } // Instantiate a cell array to collect all the edges as diff --git a/Filters/Core/vtkHull.cxx b/Filters/Core/vtkHull.cxx index d0db37a07c1..f0dc8df80db 100644 --- a/Filters/Core/vtkHull.cxx +++ b/Filters/Core/vtkHull.cxx @@ -512,37 +512,39 @@ void vtkHull::ComputePlaneDistances(vtkPointSet* input) // For all other vertices in the geometry, check if it produces a larger // D value for each of the planes. Threaded because for larger models, // looping over all the points for each plane can be a lot of work. - vtkSMPTools::For(1, numPts, [&](vtkIdType ptId, vtkIdType endPtId) { - bool isFirst = vtkSMPTools::GetSingleThread(); - vtkIdType checkAbortInterval = std::min((endPtId - ptId) / 10 + 1, (vtkIdType)1000); - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(1, numPts, + [&](vtkIdType ptId, vtkIdType endPtId) { - if (ptId % checkAbortInterval == 0) + bool isFirst = vtkSMPTools::GetSingleThread(); + vtkIdType checkAbortInterval = std::min((endPtId - ptId) / 10 + 1, (vtkIdType)1000); + for (; ptId < endPtId; ++ptId) { - if (isFirst) + if (ptId % checkAbortInterval == 0) { - this->CheckAbort(); - } - if (this->GetAbortOutput()) - { - break; + if (isFirst) + { + this->CheckAbort(); + } + if (this->GetAbortOutput()) + { + break; + } } - } - double v, coord[3]; - inPts->GetPoint(ptId, coord); - for (auto j = 0; j < numPlanes; j++) - { - v = -(planes[j * 4 + 0] * coord[0] + planes[j * 4 + 1] * coord[1] + - planes[j * 4 + 2] * coord[2]); - // negative means further in + direction of plane - if (v < planes[j * 4 + 3]) + double v, coord[3]; + inPts->GetPoint(ptId, coord); + for (auto j = 0; j < numPlanes; j++) { - planes[j * 4 + 3] = v; + v = -(planes[j * 4 + 0] * coord[0] + planes[j * 4 + 1] * coord[1] + + planes[j * 4 + 2] * coord[2]); + // negative means further in + direction of plane + if (v < planes[j * 4 + 3]) + { + planes[j * 4 + 3] = v; + } } } - } - }); // end lambda + }); // end lambda } //------------------------------------------------------------------------------ diff --git a/Filters/Core/vtkHyperTreeGridProbeFilter.cxx b/Filters/Core/vtkHyperTreeGridProbeFilter.cxx index 9afed3b07e9..6316f0ca00b 100644 --- a/Filters/Core/vtkHyperTreeGridProbeFilter.cxx +++ b/Filters/Core/vtkHyperTreeGridProbeFilter.cxx @@ -382,7 +382,8 @@ public: this->ThreadGlobCellIds->SetNumberOfIds(nPointsFound); nPointsFound = 0; - auto mergeThreadResults = [this, &nPointsFound](LocalData& loc) { + auto mergeThreadResults = [this, &nPointsFound](LocalData& loc) + { std::copy( loc.pointIds.begin(), loc.pointIds.end(), this->ThreadGlobPointIds->begin() + nPointsFound); std::copy( diff --git a/Filters/Core/vtkHyperTreeGridProbeFilterUtilities.cxx b/Filters/Core/vtkHyperTreeGridProbeFilterUtilities.cxx index abc14a7a646..24b6c80787b 100644 --- a/Filters/Core/vtkHyperTreeGridProbeFilterUtilities.cxx +++ b/Filters/Core/vtkHyperTreeGridProbeFilterUtilities.cxx @@ -23,12 +23,14 @@ void FillDefaultArray(vtkAbstractArray* array) if (strArray) { - vtkSMPTools::For(0, strArray->GetNumberOfValues(), [strArray](vtkIdType start, vtkIdType end) { - for (vtkIdType i = start; i < end; ++i) + vtkSMPTools::For(0, strArray->GetNumberOfValues(), + [strArray](vtkIdType start, vtkIdType end) { - strArray->SetValue(i, ""); - } - }); + for (vtkIdType i = start; i < end; ++i) + { + strArray->SetValue(i, ""); + } + }); } else if (dataArray) { diff --git a/Filters/Core/vtkOrientPolyData.cxx b/Filters/Core/vtkOrientPolyData.cxx index e7e9afe319f..9947ae3f60a 100644 --- a/Filters/Core/vtkOrientPolyData.cxx +++ b/Filters/Core/vtkOrientPolyData.cxx @@ -298,7 +298,8 @@ int vtkOrientPolyData::RequestData(vtkInformation* vtkNotUsed(request), } // Update the best data with the current values. - auto setBestSoFar = [&]() { + auto setBestSoFar = [&]() + { // ID bestCellID = currentCellID; // If the current leftmost cell's normal is pointing to the diff --git a/Filters/Core/vtkPlaneCutter.cxx b/Filters/Core/vtkPlaneCutter.cxx index 9a9f73e532c..dcf9e331034 100644 --- a/Filters/Core/vtkPlaneCutter.cxx +++ b/Filters/Core/vtkPlaneCutter.cxx @@ -864,12 +864,14 @@ void vtkPlaneCutter::AddNormalArray(double* planeNormal, vtkPolyData* polyData) newNormals->SetNumberOfComponents(3); newNormals->SetName("Normals"); newNormals->SetNumberOfTuples(polyData->GetNumberOfPoints()); - vtkSMPTools::For(0, polyData->GetNumberOfPoints(), [&](vtkIdType begin, vtkIdType end) { - for (vtkIdType i = begin; i < end; ++i) + vtkSMPTools::For(0, polyData->GetNumberOfPoints(), + [&](vtkIdType begin, vtkIdType end) { - newNormals->SetTuple(i, planeNormal); - } - }); + for (vtkIdType i = begin; i < end; ++i) + { + newNormals->SetTuple(i, planeNormal); + } + }); polyData->GetPointData()->AddArray(newNormals); } diff --git a/Filters/Core/vtkPolyDataEdgeConnectivityFilter.cxx b/Filters/Core/vtkPolyDataEdgeConnectivityFilter.cxx index 3f11dd21c60..7eade6e4804 100644 --- a/Filters/Core/vtkPolyDataEdgeConnectivityFilter.cxx +++ b/Filters/Core/vtkPolyDataEdgeConnectivityFilter.cxx @@ -163,7 +163,7 @@ void vtkPolyDataEdgeConnectivityFilter::SortRegionsByArea() vtkIdType vtkPolyDataEdgeConnectivityFilter::FindNumberOfExtractedRegions() { vtkIdType regionNum = 0, numSizes = this->RegionSizes->GetNumberOfTuples(); - while (regionNum < numSizes && this->RegionSizes->GetValue(regionNum) > 0) + while (regionNum<numSizes&& this->RegionSizes->GetValue(regionNum)> 0) { regionNum++; } diff --git a/Filters/Core/vtkPolyDataNormals.cxx b/Filters/Core/vtkPolyDataNormals.cxx index e11d59cefcd..7f7173f8de5 100644 --- a/Filters/Core/vtkPolyDataNormals.cxx +++ b/Filters/Core/vtkPolyDataNormals.cxx @@ -88,42 +88,48 @@ vtkSmartPointer<vtkFloatArray> vtkPolyDataNormals::GetCellNormals(vtkPolyData* d // Set default value for vertices and lines cell normals vtkIdType offsetCells = numVertices + numLines; - vtkSMPTools::For(0, offsetCells, [&](vtkIdType begin, vtkIdType end) { - static constexpr float n[3] = { 1.0, 0.0, 0.0 }; - for (vtkIdType cellId = begin; cellId < end; cellId++) + vtkSMPTools::For(0, offsetCells, + [&](vtkIdType begin, vtkIdType end) { - // add a default value for vertices and lines - // normals do not have meaningful values, we set them to X - cellNormals->SetTypedTuple(cellId, n); - } - }); + static constexpr float n[3] = { 1.0, 0.0, 0.0 }; + for (vtkIdType cellId = begin; cellId < end; cellId++) + { + // add a default value for vertices and lines + // normals do not have meaningful values, we set them to X + cellNormals->SetTypedTuple(cellId, n); + } + }); // Compute Cell Normals of polys vtkSMPThreadLocalObject<vtkIdList> tlTempCellPointIds; - vtkSMPTools::For(0, numPolys, [&](vtkIdType begin, vtkIdType end) { - auto tempCellPointIds = tlTempCellPointIds.Local(); - vtkIdType npts; - const vtkIdType* pts = nullptr; - double n[3]; - for (vtkIdType polyId = begin; polyId < end; polyId++) + vtkSMPTools::For(0, numPolys, + [&](vtkIdType begin, vtkIdType end) { - polys->GetCellAtId(polyId, npts, pts, tempCellPointIds); - vtkPolygon::ComputeNormal(points, npts, pts, n); - cellNormals->SetTuple(offsetCells + polyId, n); - } - }); + auto tempCellPointIds = tlTempCellPointIds.Local(); + vtkIdType npts; + const vtkIdType* pts = nullptr; + double n[3]; + for (vtkIdType polyId = begin; polyId < end; polyId++) + { + polys->GetCellAtId(polyId, npts, pts, tempCellPointIds); + vtkPolygon::ComputeNormal(points, npts, pts, n); + cellNormals->SetTuple(offsetCells + polyId, n); + } + }); // Set default value for strip cell normals offsetCells += numPolys; - vtkSMPTools::For(0, numStrips, [&](vtkIdType begin, vtkIdType end) { - static constexpr float n[3] = { 1.0, 0.0, 0.0 }; - for (vtkIdType cellId = begin; cellId < end; cellId++) + vtkSMPTools::For(0, numStrips, + [&](vtkIdType begin, vtkIdType end) { - // add a default value for strips - // normals do not have meaningful values, we set them to X - cellNormals->SetTypedTuple(cellId, n); - } - }); + static constexpr float n[3] = { 1.0, 0.0, 0.0 }; + for (vtkIdType cellId = begin; cellId < end; cellId++) + { + // add a default value for strips + // normals do not have meaningful values, we set them to X + cellNormals->SetTypedTuple(cellId, n); + } + }); return cellNormals; } @@ -150,28 +156,30 @@ vtkSmartPointer<vtkFloatArray> vtkPolyDataNormals::GetPointNormals( float* pointNormalsPtr = pointNormals->GetPointer(0); float* cellNormalsPtr = cellNormals->GetPointer(0); - vtkSMPTools::For(0, numPoints, [&](vtkIdType begin, vtkIdType end) { - vtkIdType nCells; - vtkIdType* cells = nullptr; - for (vtkIdType pointId = begin; pointId < end; pointId++) + vtkSMPTools::For(0, numPoints, + [&](vtkIdType begin, vtkIdType end) { - // Initialize point normals - float* pointNormal = &pointNormalsPtr[3 * pointId]; - pointNormal[0] = pointNormal[1] = pointNormal[2] = 0.0; - // Compute Point Normals - data->GetPointCells(pointId, nCells, cells); - for (vtkIdType i = 0; i < nCells; ++i) - { - vtkMath::Add(pointNormal, &cellNormalsPtr[3 * cells[i]], pointNormal); - } - // Normalize normals - const double length = vtkMath::Norm(pointNormal) * flipDirection; - if (length != 0.0) + vtkIdType nCells; + vtkIdType* cells = nullptr; + for (vtkIdType pointId = begin; pointId < end; pointId++) { - vtkMath::MultiplyScalar(pointNormal, 1.0 / length); + // Initialize point normals + float* pointNormal = &pointNormalsPtr[3 * pointId]; + pointNormal[0] = pointNormal[1] = pointNormal[2] = 0.0; + // Compute Point Normals + data->GetPointCells(pointId, nCells, cells); + for (vtkIdType i = 0; i < nCells; ++i) + { + vtkMath::Add(pointNormal, &cellNormalsPtr[3 * cells[i]], pointNormal); + } + // Normalize normals + const double length = vtkMath::Norm(pointNormal) * flipDirection; + if (length != 0.0) + { + vtkMath::MultiplyScalar(pointNormal, 1.0 / length); + } } - } - }); + }); return pointNormals; } diff --git a/Filters/Core/vtkPolyDataPlaneClipper.cxx b/Filters/Core/vtkPolyDataPlaneClipper.cxx index b40f64fe4ba..6944dda2928 100644 --- a/Filters/Core/vtkPolyDataPlaneClipper.cxx +++ b/Filters/Core/vtkPolyDataPlaneClipper.cxx @@ -530,8 +530,9 @@ struct OutputPointsWorker vtkIdType numOutPts = outPts->GetNumberOfTuples(); // Copy kept points to output. - vtkSMPTools::For( - 0, numInPts, [&, inPts, outPts, ptMap, arrays, filter](vtkIdType ptId, vtkIdType endPtId) { + vtkSMPTools::For(0, numInPts, + [&, inPts, outPts, ptMap, arrays, filter](vtkIdType ptId, vtkIdType endPtId) + { const auto in = vtk::DataArrayTupleRange<3>(inPts); auto out = vtk::DataArrayTupleRange<3>(outPts); bool isFirst = vtkSMPTools::GetSingleThread(); @@ -573,7 +574,8 @@ struct OutputPointsWorker vtkIdType numKeptPts = numOutPts - numNewPts; vtkSMPTools::For(0, numNewPts, [&, numKeptPts, outPts, mergeEdges, mergeOffsets, arrays, filter]( - vtkIdType newPtId, vtkIdType endNewPtId) { + vtkIdType newPtId, vtkIdType endNewPtId) + { const auto in = vtk::DataArrayTupleRange<3>(inPts); auto out = vtk::DataArrayTupleRange<3>(outPts); double x0[3], x1[3]; @@ -652,7 +654,8 @@ struct OutputCells vtkSMPTools::For(0, numNewPts, [&, numKeptPts, edges, offsets, cellsConn, linesConn, filter]( - vtkIdType newPtId, vtkIdType endNewPtId) { + vtkIdType newPtId, vtkIdType endNewPtId) + { const EdgeTupleType* edge; bool isFirst = vtkSMPTools::GetSingleThread(); vtkIdType checkAbortInterval = std::min((endNewPtId - newPtId) / 10 + 1, (vtkIdType)1000); @@ -782,7 +785,8 @@ void GenerateCap(vtkCellArray* lines, vtkPolyData* pd) vtkSMPTools::For(0, numTris, [&, totTris, ids, outTrisPtr, outConnPtr, outOffsetsPtr]( - vtkIdType triId, vtkIdType endTriId) { + vtkIdType triId, vtkIdType endTriId) + { for (; triId < endTriId; ++triId) { vtkIdType tID = triId + totTris; diff --git a/Filters/Core/vtkPolyDataPlaneCutter.cxx b/Filters/Core/vtkPolyDataPlaneCutter.cxx index 64ebe432113..75b9c8eaefe 100644 --- a/Filters/Core/vtkPolyDataPlaneCutter.cxx +++ b/Filters/Core/vtkPolyDataPlaneCutter.cxx @@ -444,8 +444,9 @@ struct OutputLines const vtkIdType* offsets = this->MergeOffsets; vtkIdType* linesConn = this->OutLinesConn; - vtkSMPTools::For( - 0, numNewPts, [&, edges, offsets, linesConn](vtkIdType newPtId, vtkIdType endNewPtId) { + vtkSMPTools::For(0, numNewPts, + [&, edges, offsets, linesConn](vtkIdType newPtId, vtkIdType endNewPtId) + { const EdgeTupleType* edge; bool isFirst = vtkSMPTools::GetSingleThread(); vtkIdType checkAbortInterval = std::min((endNewPtId - newPtId) / 10 + 1, (vtkIdType)1000); @@ -493,7 +494,8 @@ struct OutputPointsWorker plane->GetNormal(normal); vtkMath::Normalize(normal); vtkSMPTools::For(0, numNewPts, - [&, outPts, mergeEdges, mergeOffsets, arrays](vtkIdType newPtId, vtkIdType endNewPtId) { + [&, outPts, mergeEdges, mergeOffsets, arrays](vtkIdType newPtId, vtkIdType endNewPtId) + { const auto in = vtk::DataArrayTupleRange<3>(inPts); auto out = vtk::DataArrayTupleRange<3>(outPts); double x0[3], x1[3]; @@ -723,12 +725,14 @@ int vtkPolyDataPlaneCutter::RequestData(vtkInformation* vtkNotUsed(request), normals->SetNumberOfTuples(numOutPts); double planeNormal[3]; this->Plane->GetNormal(planeNormal); - vtkSMPTools::For(0, numOutPts, [&](vtkIdType begin, vtkIdType end) { - for (vtkIdType i = begin; i < end; ++i) + vtkSMPTools::For(0, numOutPts, + [&](vtkIdType begin, vtkIdType end) { - normals->SetTuple(i, planeNormal); - } - }); + for (vtkIdType i = begin; i < end; ++i) + { + normals->SetTuple(i, planeNormal); + } + }); output->GetPointData()->AddArray(normals); } diff --git a/Filters/Core/vtkPolyDataToUnstructuredGrid.cxx b/Filters/Core/vtkPolyDataToUnstructuredGrid.cxx index 2325ccfe3b2..00978ea3c4b 100644 --- a/Filters/Core/vtkPolyDataToUnstructuredGrid.cxx +++ b/Filters/Core/vtkPolyDataToUnstructuredGrid.cxx @@ -74,13 +74,15 @@ struct BuildCellTypesImpl return; } - vtkSMPTools::For(0, numCells, [&](vtkIdType begin, vtkIdType end) { - auto types = cellTypes->GetPointer(offset); - for (vtkIdType cellId = begin; cellId < end; ++cellId) + vtkSMPTools::For(0, numCells, + [&](vtkIdType begin, vtkIdType end) { - types[cellId] = static_cast<unsigned char>(typer(state.GetCellSize(cellId))); - } - }); + auto types = cellTypes->GetPointer(offset); + for (vtkIdType cellId = begin; cellId < end; ++cellId) + { + types[cellId] = static_cast<unsigned char>(typer(state.GetCellSize(cellId))); + } + }); } }; @@ -97,18 +99,22 @@ struct BuildConnectivityImpl const vtkIdType numCells = state.GetNumberOfCells(); // copy connectivity values - vtkSMPTools::For(0, connectivitySize, [&](vtkIdType begin, vtkIdType end) { - auto inConnPtr = inConnectivity->GetPointer(0); - auto outConnPtr = outConnectivity->GetPointer(connectivityOffset); - std::copy(inConnPtr + begin, inConnPtr + end, outConnPtr + begin); - }); + vtkSMPTools::For(0, connectivitySize, + [&](vtkIdType begin, vtkIdType end) + { + auto inConnPtr = inConnectivity->GetPointer(0); + auto outConnPtr = outConnectivity->GetPointer(connectivityOffset); + std::copy(inConnPtr + begin, inConnPtr + end, outConnPtr + begin); + }); // transform offset values - vtkSMPTools::For(0, numCells, [&](vtkIdType begin, vtkIdType end) { - auto inOffPtr = inOffsets->GetPointer(0); - auto outOffPtr = outOffSets->GetPointer(offset); - std::transform(inOffPtr + begin, inOffPtr + end, outOffPtr + begin, - [&connectivityOffset](IdType val) -> vtkIdType { return val + connectivityOffset; }); - }); + vtkSMPTools::For(0, numCells, + [&](vtkIdType begin, vtkIdType end) + { + auto inOffPtr = inOffsets->GetPointer(0); + auto outOffPtr = outOffSets->GetPointer(offset); + std::transform(inOffPtr + begin, inOffPtr + end, outOffPtr + begin, + [&connectivityOffset](IdType val) -> vtkIdType { return val + connectivityOffset; }); + }); } }; } // end anonymous namespace @@ -179,7 +185,8 @@ int vtkPolyDataToUnstructuredGrid::RequestData( offset += numLines; input->GetPolys()->Visit( BuildCellTypesImpl{}, cellTypes, - [](vtkIdType size) -> VTKCellType { + [](vtkIdType size) -> VTKCellType + { switch (size) { case 3: diff --git a/Filters/Core/vtkSplitSharpEdgesPolyData.cxx b/Filters/Core/vtkSplitSharpEdgesPolyData.cxx index 8583759ca10..21b122ae407 100644 --- a/Filters/Core/vtkSplitSharpEdgesPolyData.cxx +++ b/Filters/Core/vtkSplitSharpEdgesPolyData.cxx @@ -326,7 +326,8 @@ struct vtkSplitSharpEdgesPolyData::MarkAndSplitFunctor vtkSMPThreadLocalObject<vtkIdList> tlTempCellPointIds; vtkSMPTools::For(0, this->PointBatches.GetNumberOfBatches(), - [&](vtkIdType beginBatchId, vtkIdType endBatchId) { + [&](vtkIdType beginBatchId, vtkIdType endBatchId) + { auto& tempCellPointIds = tlTempCellPointIds.Local(); const bool isFirst = vtkSMPTools::GetSingleThread(); for (vtkIdType batchId = beginBatchId; batchId < endBatchId; ++batchId) @@ -421,9 +422,10 @@ int vtkSplitSharpEdgesPolyData::RequestData(vtkInformation* vtkNotUsed(request), // to map new points into old points. vtkNew<vtkIdList> newToOldPointsMap; newToOldPointsMap->SetNumberOfIds(numInPoints); - vtkSMPTools::For(0, numInPoints, [&](vtkIdType begin, vtkIdType end) { - std::iota(newToOldPointsMap->GetPointer(begin), newToOldPointsMap->GetPointer(end), begin); - }); + vtkSMPTools::For(0, numInPoints, + [&](vtkIdType begin, vtkIdType end) { + std::iota(newToOldPointsMap->GetPointer(begin), newToOldPointsMap->GetPointer(end), begin); + }); MarkAndSplitFunctor functor(input, output, cellNormals, newToOldPointsMap, this); vtkSMPTools::For(0, functor.PointBatches.GetNumberOfBatches(), functor); @@ -467,16 +469,18 @@ int vtkSplitSharpEdgesPolyData::RequestData(vtkInformation* vtkNotUsed(request), newPoints->SetNumberOfPoints(numOutPoints); outPD->SetNumberOfTuples(numOutPoints); vtkIdType* mapPtr = newToOldPointsMap->GetPointer(0); - vtkSMPTools::For(0, numOutPoints, [&](vtkIdType begin, vtkIdType end) { - double p[3]; - for (vtkIdType newPointId = begin; newPointId < end; newPointId++) + vtkSMPTools::For(0, numOutPoints, + [&](vtkIdType begin, vtkIdType end) { - const vtkIdType& oldPointId = mapPtr[newPointId]; - inPoints->GetPoint(oldPointId, p); - newPoints->SetPoint(newPointId, p); - outPD->CopyData(inPD, oldPointId, newPointId); - } - }); + double p[3]; + for (vtkIdType newPointId = begin; newPointId < end; newPointId++) + { + const vtkIdType& oldPointId = mapPtr[newPointId]; + inPoints->GetPoint(oldPointId, p); + newPoints->SetPoint(newPointId, p); + outPD->CopyData(inPD, oldPointId, newPointId); + } + }); output->SetPoints(newPoints); } diff --git a/Filters/Core/vtkStaticCleanUnstructuredGrid.cxx b/Filters/Core/vtkStaticCleanUnstructuredGrid.cxx index 80192b1ebdb..2d203e1e2f3 100644 --- a/Filters/Core/vtkStaticCleanUnstructuredGrid.cxx +++ b/Filters/Core/vtkStaticCleanUnstructuredGrid.cxx @@ -288,22 +288,26 @@ void UpdateCellArrayConnectivity(vtkCellArray* ca, vtkIdType* ptMap) if (ca->IsStorage64Bit()) { vtkTypeInt64* c = ca->GetConnectivityArray64()->GetPointer(0); - vtkSMPTools::For(0, numConn, [&, c, ptMap](vtkIdType id, vtkIdType endId) { - for (; id < endId; ++id) + vtkSMPTools::For(0, numConn, + [&, c, ptMap](vtkIdType id, vtkIdType endId) { - c[id] = ptMap[c[id]]; - } - }); // end lambda + for (; id < endId; ++id) + { + c[id] = ptMap[c[id]]; + } + }); // end lambda } else { vtkTypeInt32* c = ca->GetConnectivityArray32()->GetPointer(0); - vtkSMPTools::For(0, numConn, [&, c, ptMap](vtkIdType id, vtkIdType endId) { - for (; id < endId; ++id) + vtkSMPTools::For(0, numConn, + [&, c, ptMap](vtkIdType id, vtkIdType endId) { - c[id] = ptMap[c[id]]; - } - }); // end lambda + for (; id < endId; ++id) + { + c[id] = ptMap[c[id]]; + } + }); // end lambda } } diff --git a/Filters/Core/vtkStructuredDataPlaneCutter.cxx b/Filters/Core/vtkStructuredDataPlaneCutter.cxx index 86e7643704e..8e59045655a 100644 --- a/Filters/Core/vtkStructuredDataPlaneCutter.cxx +++ b/Filters/Core/vtkStructuredDataPlaneCutter.cxx @@ -532,8 +532,9 @@ struct EvaluateCellsStructuredFunctor } // merge thread local edges this->Edges.resize(totalSizeOfEdges); - vtkSMPTools::For( - 0, static_cast<vtkIdType>(tlEdgesVector.size()), [&](vtkIdType begin, vtkIdType end) { + vtkSMPTools::For(0, static_cast<vtkIdType>(tlEdgesVector.size()), + [&](vtkIdType begin, vtkIdType end) + { for (vtkIdType threadId = begin; threadId < end; ++threadId) { auto& edges = *tlEdgesVector[threadId]; @@ -732,7 +733,8 @@ struct ExtractPointsWorker vtkStructuredDataPlaneCutter* filter) { // create edge points - auto extractEdgePoints = [&](vtkIdType beginEdgeId, vtkIdType endEdgeId) { + auto extractEdgePoints = [&](vtkIdType beginEdgeId, vtkIdType endEdgeId) + { const auto& inPts = vtk::DataArrayTupleRange<3>(inputPoints); auto outPts = vtk::DataArrayTupleRange<3>(outputPoints); double edgePoint1[3], edgePoint2[3]; @@ -1004,9 +1006,9 @@ int vtkStructuredDataPlaneCutter::RequestData(vtkInformation* vtkNotUsed(request constantScalars->SetName("ConstantScalars"); constantScalars->SetNumberOfComponents(1); constantScalars->SetNumberOfTuples(tmpImage->GetNumberOfPoints()); - vtkSMPTools::For(0, tmpImage->GetNumberOfPoints(), [&](vtkIdType begin, vtkIdType end) { - std::fill_n(constantScalars->GetPointer(begin), (end - begin), 1.0f); - }); + vtkSMPTools::For(0, tmpImage->GetNumberOfPoints(), + [&](vtkIdType begin, vtkIdType end) + { std::fill_n(constantScalars->GetPointer(begin), (end - begin), 1.0f); }); tmpImage->GetPointData()->AddArray(constantScalars); tmpImage->GetPointData()->SetActiveScalars(constantScalars->GetName()); tmpInput = tmpImage; @@ -1148,12 +1150,14 @@ int vtkStructuredDataPlaneCutter::RequestData(vtkInformation* vtkNotUsed(request newNormals->SetNumberOfComponents(3); newNormals->SetName("Normals"); newNormals->SetNumberOfTuples(output->GetNumberOfPoints()); - vtkSMPTools::For(0, output->GetNumberOfPoints(), [&](vtkIdType begin, vtkIdType end) { - for (vtkIdType i = begin; i < end; ++i) + vtkSMPTools::For(0, output->GetNumberOfPoints(), + [&](vtkIdType begin, vtkIdType end) { - newNormals->SetTuple(i, planeNormal); - } - }); + for (vtkIdType i = begin; i < end; ++i) + { + newNormals->SetTuple(i, planeNormal); + } + }); output->GetPointData()->AddArray(newNormals); } diff --git a/Filters/Core/vtkSurfaceNets2D.cxx b/Filters/Core/vtkSurfaceNets2D.cxx index 8ab41d3ab88..c7628b0417a 100644 --- a/Filters/Core/vtkSurfaceNets2D.cxx +++ b/Filters/Core/vtkSurfaceNets2D.cxx @@ -740,18 +740,22 @@ void SurfaceNets<T>::ConfigureOutput( // (i.e., row interleaving is performed). vtkIdType numRows = this->DyadDims[1]; vtkIdType numRowPairs = (numRows - 1) / 2 + 1; - vtkSMPTools::For(0, numRowPairs, [this](vtkIdType rowPair, vtkIdType endRowPair) { - for (; rowPair < endRowPair; ++rowPair) + vtkSMPTools::For(0, numRowPairs, + [this](vtkIdType rowPair, vtkIdType endRowPair) { - this->ProduceSquareCases(rowPair, false); // even rows - } - }); - vtkSMPTools::For(0, numRowPairs, [this](vtkIdType rowPair, vtkIdType endRowPair) { - for (; rowPair < endRowPair; ++rowPair) + for (; rowPair < endRowPair; ++rowPair) + { + this->ProduceSquareCases(rowPair, false); // even rows + } + }); + vtkSMPTools::For(0, numRowPairs, + [this](vtkIdType rowPair, vtkIdType endRowPair) { - this->ProduceSquareCases(rowPair, true); // odd rows - } - }); + for (; rowPair < endRowPair; ++rowPair) + { + this->ProduceSquareCases(rowPair, true); // odd rows + } + }); // Begin prefix sum to determine the point, line, and stencil number // offsets for each row. diff --git a/Filters/Core/vtkSurfaceNets3D.cxx b/Filters/Core/vtkSurfaceNets3D.cxx index 457c72bf064..77b1ec359e0 100644 --- a/Filters/Core/vtkSurfaceNets3D.cxx +++ b/Filters/Core/vtkSurfaceNets3D.cxx @@ -1396,8 +1396,9 @@ void SurfaceNets<T>::ConfigureOutput( // Edge groups consist of four neighboring volume x-edges (+/-y,+/-z). Process // in interleaving fashion (i.e., checkerboard) to avoid races (ProduceVoxelCases() // may write to the voxel classifications while they are being processed). - vtkSMPTools::For( - 0, numGroups, [this, edgeNum, numRowPairs](vtkIdType group, vtkIdType endGroup) { + vtkSMPTools::For(0, numGroups, + [this, edgeNum, numRowPairs](vtkIdType group, vtkIdType endGroup) + { for (; group < endGroup; ++group) { this->ProduceVoxelCases(group, edgeNum, numRowPairs); @@ -1741,14 +1742,16 @@ struct NetsWorker // which will likely by updated in pass1, pass2, or pass3. algo.NumberOfEdges = algo.TriadDims[1] * algo.TriadDims[2]; // y-z plane of edges algo.EdgeMetaData = new vtkIdType[algo.NumberOfEdges * algo.EdgeMetaDataSize](); - vtkSMPTools::For(0, algo.NumberOfEdges, [&](vtkIdType begin, vtkIdType end) { - for (vtkIdType eNum = begin; eNum < end; ++eNum) + vtkSMPTools::For(0, algo.NumberOfEdges, + [&](vtkIdType begin, vtkIdType end) { - vtkIdType* eMD = algo.EdgeMetaData + eNum * algo.EdgeMetaDataSize; - eMD[3] = algo.TriadDims[0]; - eMD[4] = 0; - } - }); + for (vtkIdType eNum = begin; eNum < end; ++eNum) + { + vtkIdType* eMD = algo.EdgeMetaData + eNum * algo.EdgeMetaDataSize; + eMD[3] = algo.TriadDims[0]; + eMD[4] = 0; + } + }); // Compute the starting offset location for scalar data. We may be operating // on a part of the volume. @@ -2138,8 +2141,8 @@ struct SelectWorker // Traverse all existing cells and mark those satisfying outputStyle // criterion for extraction. vtkSMPTools::For(0, numCells, - [&newScalars, outputStyle, &selectedCells, self, lMap]( - vtkIdType cellId, vtkIdType endCellId) { + [&newScalars, outputStyle, &selectedCells, self, lMap](vtkIdType cellId, vtkIdType endCellId) + { const auto inTuples = vtk::DataArrayTupleRange<2>(newScalars); ValueType backgroundLabel = static_cast<ValueType>(self->GetBackgroundLabel()); for (; cellId < endCellId; ++cellId) @@ -2179,7 +2182,8 @@ struct SelectWorker vtkSMPThreadLocalObject<vtkIdList> tlIdList; vtkSMPTools::For(0, numCells, [newCells, &selectedCells, &outCells, cellSize, &tlIdList]( - vtkIdType cellId, vtkIdType endCellId) { + vtkIdType cellId, vtkIdType endCellId) + { auto& idList = tlIdList.Local(); vtkIdType npts; const vtkIdType* pts; @@ -2201,7 +2205,8 @@ struct SelectWorker outScalars->SetNumberOfComponents(2); outScalars->SetNumberOfTuples(numOutCells); vtkSMPTools::For(0, numCells, - [&selectedCells, &newScalars, &outScalars](vtkIdType cellId, vtkIdType endCellId) { + [&selectedCells, &newScalars, &outScalars](vtkIdType cellId, vtkIdType endCellId) + { const auto inTuples = vtk::DataArrayTupleRange<2>(newScalars); auto outTuples = vtk::DataArrayTupleRange<2>(outScalars); for (; cellId < endCellId; ++cellId) diff --git a/Filters/Core/vtkVectorDot.cxx b/Filters/Core/vtkVectorDot.cxx index 58e76c0962e..0f56bc87a73 100644 --- a/Filters/Core/vtkVectorDot.cxx +++ b/Filters/Core/vtkVectorDot.cxx @@ -54,7 +54,8 @@ struct DotWorker using NormalConstRef = typename decltype(normals)::ConstTupleReferenceType; using VectorConstRef = typename decltype(vectors)::ConstTupleReferenceType; - auto computeScalars = [&](NormalConstRef n, VectorConstRef v) -> float { + auto computeScalars = [&](NormalConstRef n, VectorConstRef v) -> float + { const float s = static_cast<float>(n[0] * v[0] + n[1] * v[1] + n[2] * v[2]); min = std::min(min, s); diff --git a/Filters/Core/vtkVectorNorm.cxx b/Filters/Core/vtkVectorNorm.cxx index 67cf7957990..34a800da3c2 100644 --- a/Filters/Core/vtkVectorNorm.cxx +++ b/Filters/Core/vtkVectorNorm.cxx @@ -102,13 +102,15 @@ struct vtkVectorNormDispatch // Interface between VTK and templated functions. if (max > 0.0 && normalize) { - vtkSMPTools::For(0, num, [&](vtkIdType i, vtkIdType end) { - float* s = algo.Scalars + i; - for (; i < end; ++i) + vtkSMPTools::For(0, num, + [&](vtkIdType i, vtkIdType end) { - *s++ /= max; - } - }); + float* s = algo.Scalars + i; + for (; i < end; ++i) + { + *s++ /= max; + } + }); } } }; diff --git a/Filters/Core/vtkWindowedSincPolyDataFilter.cxx b/Filters/Core/vtkWindowedSincPolyDataFilter.cxx index 211c81e6695..49f0b94695b 100644 --- a/Filters/Core/vtkWindowedSincPolyDataFilter.cxx +++ b/Filters/Core/vtkWindowedSincPolyDataFilter.cxx @@ -55,19 +55,21 @@ vtkSmartPointer<vtkDoubleArray> ComputeNormals(vtkPolyData* mesh) normals->SetNumberOfTuples(numCells); double* n = normals->GetPointer(0); - vtkSMPTools::For(0, numCells, [&, pts, polys, n](vtkIdType cellId, vtkIdType endCellId) { - vtkSmartPointer<vtkCellArrayIterator> cellIter; - cellIter.TakeReference(polys->NewIterator()); - vtkIdType npts; - const vtkIdType* points; - double* normal = n + 3 * cellId; - - for (; cellId < endCellId; ++cellId, normal += 3) + vtkSMPTools::For(0, numCells, + [&, pts, polys, n](vtkIdType cellId, vtkIdType endCellId) { - cellIter->GetCellAtId(cellId, npts, points); - vtkPolygon::ComputeNormal(pts, npts, points, normal); - } - }); // end lambda + vtkSmartPointer<vtkCellArrayIterator> cellIter; + cellIter.TakeReference(polys->NewIterator()); + vtkIdType npts; + const vtkIdType* points; + double* normal = n + 3 * cellId; + + for (; cellId < endCellId; ++cellId, normal += 3) + { + cellIter->GetCellAtId(cellId, npts, points); + vtkPolygon::ComputeNormal(pts, npts, points, normal); + } + }); // end lambda return normals; } // ComputeNormals @@ -918,22 +920,24 @@ void AnalyzePointTopology(PointConnectivityBase* ptConnBase, vtkWindowedSincPoly vtkIdType numVerts = (verts != nullptr ? verts->GetNumberOfCells() : 0); if (numVerts > 0 && !filter->CheckAbort()) { - vtkSMPTools::For(0, numVerts, [&, verts, ptConn](vtkIdType cellId, vtkIdType endCellId) { - vtkSmartPointer<vtkCellArrayIterator> vIter; - vIter.TakeReference(verts->NewIterator()); - vtkIdType npts; - const vtkIdType* p; - - for (; cellId < endCellId; ++cellId) + vtkSMPTools::For(0, numVerts, + [&, verts, ptConn](vtkIdType cellId, vtkIdType endCellId) { - vIter->GetCellAtId(cellId, npts, p); - for (auto j = 0; j < npts; ++j) + vtkSmartPointer<vtkCellArrayIterator> vIter; + vIter.TakeReference(verts->NewIterator()); + vtkIdType npts; + const vtkIdType* p; + + for (; cellId < endCellId; ++cellId) { - ptConn->SetEdgeCount(p[j], PointType::FIXED); + vIter->GetCellAtId(cellId, npts, p); + for (auto j = 0; j < npts; ++j) + { + ptConn->SetEdgeCount(p[j], PointType::FIXED); + } } - } - }); // end lambda - } // if any verts + }); // end lambda + } // if any verts } // AnalyzePointTopology // Initialize points prior to applying smoothing operations. @@ -943,45 +947,47 @@ struct InitializePointsWorker void operator()(DataT1* inPts, DataT2* outPts, vtkIdType numPts, int normalize, double length, double center[3], vtkWindowedSincPolyDataFilter* filter) { - vtkSMPTools::For(0, numPts, [&](vtkIdType ptId, vtkIdType endPtId) { - const auto inTuples = vtk::DataArrayTupleRange<3>(inPts); - auto outTuples = vtk::DataArrayTupleRange<3>(outPts); - double x[3]; - bool isFirst = vtkSMPTools::GetSingleThread(); - vtkIdType checkAbortInterval = std::min((endPtId - ptId) / 10 + 1, (vtkIdType)1000); - - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, numPts, + [&](vtkIdType ptId, vtkIdType endPtId) { - if (ptId % checkAbortInterval == 0) + const auto inTuples = vtk::DataArrayTupleRange<3>(inPts); + auto outTuples = vtk::DataArrayTupleRange<3>(outPts); + double x[3]; + bool isFirst = vtkSMPTools::GetSingleThread(); + vtkIdType checkAbortInterval = std::min((endPtId - ptId) / 10 + 1, (vtkIdType)1000); + + for (; ptId < endPtId; ++ptId) { - if (isFirst) + if (ptId % checkAbortInterval == 0) { - filter->CheckAbort(); + if (isFirst) + { + filter->CheckAbort(); + } + if (filter->GetAbortOutput()) + { + break; + } } - if (filter->GetAbortOutput()) + const auto inTuple = inTuples[ptId]; + auto outTuple = outTuples[ptId]; + x[0] = static_cast<double>(inTuple[0]); + x[1] = static_cast<double>(inTuple[1]); + x[2] = static_cast<double>(inTuple[2]); + + if (normalize) { - break; + x[0] = (x[0] - center[0]) / length; + x[1] = (x[1] - center[1]) / length; + x[2] = (x[2] - center[2]) / length; } - } - const auto inTuple = inTuples[ptId]; - auto outTuple = outTuples[ptId]; - x[0] = static_cast<double>(inTuple[0]); - x[1] = static_cast<double>(inTuple[1]); - x[2] = static_cast<double>(inTuple[2]); - - if (normalize) - { - x[0] = (x[0] - center[0]) / length; - x[1] = (x[1] - center[1]) / length; - x[2] = (x[2] - center[2]) / length; - } - // Now set the value of the new points - outTuple[0] = x[0]; - outTuple[1] = x[1]; - outTuple[2] = x[2]; - } // for all points - }); // end lambda + // Now set the value of the new points + outTuple[0] = x[0]; + outTuple[1] = x[1]; + outTuple[2] = x[2]; + } // for all points + }); // end lambda } }; // InitializePointsWorker @@ -1177,64 +1183,66 @@ struct InitSmoothingWorker PointConnectivity<TIds>* ptConn, double* c, int ptSelect[4], vtkWindowedSincPolyDataFilter* filter) { - vtkSMPTools::For(0, numPts, [&](vtkIdType ptId, vtkIdType endPtId) { - EDGE_COUNT_TYPE numEdges; - double deltaX[3]; - auto tuples0 = vtk::DataArrayTupleRange<3>(vtkArrayDownCast<DataT>(da[ptSelect[0]])); - auto tuples1 = vtk::DataArrayTupleRange<3>(vtkArrayDownCast<DataT>(da[ptSelect[1]])); - auto tuples3 = vtk::DataArrayTupleRange<3>(vtkArrayDownCast<DataT>(da[ptSelect[3]])); - bool isFirst = vtkSMPTools::GetSingleThread(); - vtkIdType checkAbortInterval = std::min((endPtId - ptId) / 10 + 1, (vtkIdType)1000); - - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, numPts, + [&](vtkIdType ptId, vtkIdType endPtId) { - if (ptId % checkAbortInterval == 0) + EDGE_COUNT_TYPE numEdges; + double deltaX[3]; + auto tuples0 = vtk::DataArrayTupleRange<3>(vtkArrayDownCast<DataT>(da[ptSelect[0]])); + auto tuples1 = vtk::DataArrayTupleRange<3>(vtkArrayDownCast<DataT>(da[ptSelect[1]])); + auto tuples3 = vtk::DataArrayTupleRange<3>(vtkArrayDownCast<DataT>(da[ptSelect[3]])); + bool isFirst = vtkSMPTools::GetSingleThread(); + vtkIdType checkAbortInterval = std::min((endPtId - ptId) / 10 + 1, (vtkIdType)1000); + + for (; ptId < endPtId; ++ptId) { - if (isFirst) + if (ptId % checkAbortInterval == 0) { - filter->CheckAbort(); + if (isFirst) + { + filter->CheckAbort(); + } + if (filter->GetAbortOutput()) + { + break; + } } - if (filter->GetAbortOutput()) + // Grab the edges + TIds* edges = ptConn->GetEdges(ptId); + numEdges = ptConn->GetEdgeCount(ptId); + + // calculate the negative of the laplacian + auto x = tuples0[ptId]; + deltaX[0] = deltaX[1] = deltaX[2] = 0.0; + for (auto j = 0; j < numEdges; j++) { - break; - } - } - // Grab the edges - TIds* edges = ptConn->GetEdges(ptId); - numEdges = ptConn->GetEdgeCount(ptId); - - // calculate the negative of the laplacian - auto x = tuples0[ptId]; - deltaX[0] = deltaX[1] = deltaX[2] = 0.0; - for (auto j = 0; j < numEdges; j++) - { - auto y = tuples0[edges[j]]; + auto y = tuples0[edges[j]]; + for (auto k = 0; k < 3; k++) + { + deltaX[k] += (x[k] - y[k]) / static_cast<double>(numEdges); + } + } // for all connected points + for (auto k = 0; k < 3; k++) { - deltaX[k] += (x[k] - y[k]) / static_cast<double>(numEdges); + deltaX[k] = x[k] - 0.5 * deltaX[k]; } - } // for all connected points - - for (auto k = 0; k < 3; k++) - { - deltaX[k] = x[k] - 0.5 * deltaX[k]; - } - auto dX = tuples1[ptId]; - dX[0] = deltaX[0]; - dX[1] = deltaX[1]; - dX[2] = deltaX[2]; + auto dX = tuples1[ptId]; + dX[0] = deltaX[0]; + dX[1] = deltaX[1]; + dX[2] = deltaX[2]; - for (auto k = 0; k < 3; k++) - { - deltaX[k] = c[0] * x[k] + c[1] * deltaX[k]; - } + for (auto k = 0; k < 3; k++) + { + deltaX[k] = c[0] * x[k] + c[1] * deltaX[k]; + } - auto XN = tuples3[ptId]; - XN[0] = deltaX[0]; - XN[1] = deltaX[1]; - XN[2] = deltaX[2]; - } // for all points - }); // end lambda + auto XN = tuples3[ptId]; + XN[0] = deltaX[0]; + XN[1] = deltaX[1]; + XN[2] = deltaX[2]; + } // for all points + }); // end lambda } }; // InitSmoothingWorker @@ -1246,71 +1254,73 @@ struct SmoothingWorker PointConnectivity<TIds>* ptConn, int iterNum, double* c, int ptSelect[4], vtkWindowedSincPolyDataFilter* filter) { - vtkSMPTools::For(0, numPts, [&](vtkIdType ptId, vtkIdType endPtId) { - EDGE_COUNT_TYPE numEdges; - double deltaX[3], xNew[3]; - auto tuples0 = vtk::DataArrayTupleRange<3>(vtkArrayDownCast<DataT>(da[ptSelect[0]])); - auto tuples1 = vtk::DataArrayTupleRange<3>(vtkArrayDownCast<DataT>(da[ptSelect[1]])); - auto tuples2 = vtk::DataArrayTupleRange<3>(vtkArrayDownCast<DataT>(da[ptSelect[2]])); - auto tuples3 = vtk::DataArrayTupleRange<3>(vtkArrayDownCast<DataT>(da[ptSelect[3]])); - bool isFirst = vtkSMPTools::GetSingleThread(); - vtkIdType checkAbortInterval = std::min((endPtId - ptId) / 10 + 1, (vtkIdType)1000); - - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, numPts, + [&](vtkIdType ptId, vtkIdType endPtId) { - if (ptId % checkAbortInterval == 0) + EDGE_COUNT_TYPE numEdges; + double deltaX[3], xNew[3]; + auto tuples0 = vtk::DataArrayTupleRange<3>(vtkArrayDownCast<DataT>(da[ptSelect[0]])); + auto tuples1 = vtk::DataArrayTupleRange<3>(vtkArrayDownCast<DataT>(da[ptSelect[1]])); + auto tuples2 = vtk::DataArrayTupleRange<3>(vtkArrayDownCast<DataT>(da[ptSelect[2]])); + auto tuples3 = vtk::DataArrayTupleRange<3>(vtkArrayDownCast<DataT>(da[ptSelect[3]])); + bool isFirst = vtkSMPTools::GetSingleThread(); + vtkIdType checkAbortInterval = std::min((endPtId - ptId) / 10 + 1, (vtkIdType)1000); + + for (; ptId < endPtId; ++ptId) { - if (isFirst) - { - filter->CheckAbort(); - } - if (filter->GetAbortOutput()) + if (ptId % checkAbortInterval == 0) { - break; + if (isFirst) + { + filter->CheckAbort(); + } + if (filter->GetAbortOutput()) + { + break; + } } - } - // Grab the edges - TIds* edges = ptConn->GetEdges(ptId); - numEdges = ptConn->GetEdgeCount(ptId); + // Grab the edges + TIds* edges = ptConn->GetEdges(ptId); + numEdges = ptConn->GetEdgeCount(ptId); - // The point is allowed to move - auto p_x0 = tuples0[ptId]; - auto p_x1 = tuples1[ptId]; + // The point is allowed to move + auto p_x0 = tuples0[ptId]; + auto p_x1 = tuples1[ptId]; - // Calculate the negative laplacian of x1 - deltaX[0] = deltaX[1] = deltaX[2] = 0.0; - for (auto j = 0; j < numEdges; j++) - { - auto y = tuples1[edges[j]]; + // Calculate the negative laplacian of x1 + deltaX[0] = deltaX[1] = deltaX[2] = 0.0; + for (auto j = 0; j < numEdges; j++) + { + auto y = tuples1[edges[j]]; + for (auto k = 0; k < 3; k++) + { + deltaX[k] += (p_x1[k] - y[k]) / static_cast<double>(numEdges); + } + } // for all connected points + + // Taubin: x2 = (x1 - x0) + (x1 - x2) for (auto k = 0; k < 3; k++) { - deltaX[k] += (p_x1[k] - y[k]) / static_cast<double>(numEdges); + deltaX[k] = p_x1[k] - p_x0[k] + p_x1[k] - deltaX[k]; } - } // for all connected points + auto dX = tuples2[ptId]; + dX[0] = deltaX[0]; + dX[1] = deltaX[1]; + dX[2] = deltaX[2]; - // Taubin: x2 = (x1 - x0) + (x1 - x2) - for (auto k = 0; k < 3; k++) - { - deltaX[k] = p_x1[k] - p_x0[k] + p_x1[k] - deltaX[k]; - } - auto dX = tuples2[ptId]; - dX[0] = deltaX[0]; - dX[1] = deltaX[1]; - dX[2] = deltaX[2]; - - // smooth the vertex (x3 = x3 + cj x2) - auto p_x3 = tuples3[ptId]; - for (auto k = 0; k < 3; k++) - { - xNew[k] = p_x3[k] + c[iterNum] * deltaX[k]; - } + // smooth the vertex (x3 = x3 + cj x2) + auto p_x3 = tuples3[ptId]; + for (auto k = 0; k < 3; k++) + { + xNew[k] = p_x3[k] + c[iterNum] * deltaX[k]; + } - auto XN = tuples3[ptId]; - XN[0] = xNew[0]; - XN[1] = xNew[1]; - XN[2] = xNew[2]; - } // for all points - }); // end lambda + auto XN = tuples3[ptId]; + XN[0] = xNew[0]; + XN[1] = xNew[1]; + XN[2] = xNew[2]; + } // for all points + }); // end lambda } }; // SmoothingWorker @@ -1398,35 +1408,37 @@ struct UnnormalizePointsWorker void operator()(DataT* pts, vtkIdType numPts, double length, double center[3], vtkWindowedSincPolyDataFilter* filter) { - vtkSMPTools::For(0, numPts, [&](vtkIdType ptId, vtkIdType endPtId) { - auto inTuples = vtk::DataArrayTupleRange<3>(pts, ptId, endPtId); - double x[3]; - bool isFirst = vtkSMPTools::GetSingleThread(); - vtkIdType checkAbortInterval = std::min((endPtId - ptId) / 10 + 1, (vtkIdType)1000); - - for (auto tuple : inTuples) + vtkSMPTools::For(0, numPts, + [&](vtkIdType ptId, vtkIdType endPtId) { - if (ptId % checkAbortInterval == 0) + auto inTuples = vtk::DataArrayTupleRange<3>(pts, ptId, endPtId); + double x[3]; + bool isFirst = vtkSMPTools::GetSingleThread(); + vtkIdType checkAbortInterval = std::min((endPtId - ptId) / 10 + 1, (vtkIdType)1000); + + for (auto tuple : inTuples) { - if (isFirst) - { - filter->CheckAbort(); - } - if (filter->GetAbortOutput()) + if (ptId % checkAbortInterval == 0) { - break; + if (isFirst) + { + filter->CheckAbort(); + } + if (filter->GetAbortOutput()) + { + break; + } } - } - ptId++; - x[0] = (static_cast<double>(tuple[0]) * length) + center[0]; - x[1] = (static_cast<double>(tuple[1]) * length) + center[1]; - x[2] = (static_cast<double>(tuple[2]) * length) + center[2]; - - tuple[0] = x[0]; - tuple[1] = x[1]; - tuple[2] = x[2]; - } // for all points - }); // end lambda + ptId++; + x[0] = (static_cast<double>(tuple[0]) * length) + center[0]; + x[1] = (static_cast<double>(tuple[1]) * length) + center[1]; + x[2] = (static_cast<double>(tuple[2]) * length) + center[2]; + + tuple[0] = x[0]; + tuple[1] = x[1]; + tuple[2] = x[2]; + } // for all points + }); // end lambda } }; // UnnormalizePointsWorker @@ -1453,35 +1465,37 @@ struct ErrorScalarsWorker void operator()(DataT1* inPts, DataT2* outPts, vtkIdType numPts, vtkFloatArray* es, vtkWindowedSincPolyDataFilter* filter) { - vtkSMPTools::For(0, numPts, [&](vtkIdType ptId, vtkIdType endPtId) { - const auto inTuples = vtk::DataArrayTupleRange<3>(inPts); - const auto outTuples = vtk::DataArrayTupleRange<3>(outPts); - float* esPtr = es->GetPointer(0) + ptId; - double x[3]; - bool isFirst = vtkSMPTools::GetSingleThread(); - vtkIdType checkAbortInterval = std::min((endPtId - ptId) / 10 + 1, (vtkIdType)1000); - - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, numPts, + [&](vtkIdType ptId, vtkIdType endPtId) { - if (ptId % checkAbortInterval == 0) + const auto inTuples = vtk::DataArrayTupleRange<3>(inPts); + const auto outTuples = vtk::DataArrayTupleRange<3>(outPts); + float* esPtr = es->GetPointer(0) + ptId; + double x[3]; + bool isFirst = vtkSMPTools::GetSingleThread(); + vtkIdType checkAbortInterval = std::min((endPtId - ptId) / 10 + 1, (vtkIdType)1000); + + for (; ptId < endPtId; ++ptId) { - if (isFirst) - { - filter->CheckAbort(); - } - if (filter->GetAbortOutput()) + if (ptId % checkAbortInterval == 0) { - break; + if (isFirst) + { + filter->CheckAbort(); + } + if (filter->GetAbortOutput()) + { + break; + } } - } - const auto inTuple = inTuples[ptId]; - const auto outTuple = outTuples[ptId]; - x[0] = outTuple[0] - inTuple[0]; - x[1] = outTuple[1] - inTuple[1]; - x[2] = outTuple[2] - inTuple[2]; - *esPtr++ = sqrt(vtkMath::Norm(x)); - } // for all points - }); // end lambda + const auto inTuple = inTuples[ptId]; + const auto outTuple = outTuples[ptId]; + x[0] = outTuple[0] - inTuple[0]; + x[1] = outTuple[1] - inTuple[1]; + x[2] = outTuple[2] - inTuple[2]; + *esPtr++ = sqrt(vtkMath::Norm(x)); + } // for all points + }); // end lambda } }; // ErrorScalarsWorker @@ -1514,33 +1528,35 @@ struct ErrorVectorsWorker void operator()(DataT1* inPts, DataT2* outPts, vtkIdType numPts, vtkFloatArray* ev, vtkWindowedSincPolyDataFilter* filter) { - vtkSMPTools::For(0, numPts, [&](vtkIdType ptId, vtkIdType endPtId) { - const auto inTuples = vtk::DataArrayTupleRange<3>(inPts); - const auto outTuples = vtk::DataArrayTupleRange<3>(outPts); - float* evPtr = ev->GetPointer(0) + 3 * ptId; - bool isFirst = vtkSMPTools::GetSingleThread(); - vtkIdType checkAbortInterval = std::min((endPtId - ptId) / 10 + 1, (vtkIdType)1000); - - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, numPts, + [&](vtkIdType ptId, vtkIdType endPtId) { - if (ptId % checkAbortInterval == 0) + const auto inTuples = vtk::DataArrayTupleRange<3>(inPts); + const auto outTuples = vtk::DataArrayTupleRange<3>(outPts); + float* evPtr = ev->GetPointer(0) + 3 * ptId; + bool isFirst = vtkSMPTools::GetSingleThread(); + vtkIdType checkAbortInterval = std::min((endPtId - ptId) / 10 + 1, (vtkIdType)1000); + + for (; ptId < endPtId; ++ptId) { - if (isFirst) + if (ptId % checkAbortInterval == 0) { - filter->CheckAbort(); + if (isFirst) + { + filter->CheckAbort(); + } + if (filter->GetAbortOutput()) + { + break; + } } - if (filter->GetAbortOutput()) - { - break; - } - } - const auto inTuple = inTuples[ptId]; - const auto outTuple = outTuples[ptId]; - *evPtr++ = outTuple[0] - inTuple[0]; - *evPtr++ = outTuple[1] - inTuple[1]; - *evPtr++ = outTuple[2] - inTuple[2]; - } // for all points - }); // end lambda + const auto inTuple = inTuples[ptId]; + const auto outTuple = outTuples[ptId]; + *evPtr++ = outTuple[0] - inTuple[0]; + *evPtr++ = outTuple[1] - inTuple[1]; + *evPtr++ = outTuple[2] - inTuple[2]; + } // for all points + }); // end lambda } }; // ErrorVectorsWorker diff --git a/Filters/Extraction/Testing/Cxx/TestExtractRectilinearGrid.cxx b/Filters/Extraction/Testing/Cxx/TestExtractRectilinearGrid.cxx index fd3375a58b9..64e6d1f6ce7 100644 --- a/Filters/Extraction/Testing/Cxx/TestExtractRectilinearGrid.cxx +++ b/Filters/Extraction/Testing/Cxx/TestExtractRectilinearGrid.cxx @@ -19,7 +19,7 @@ #include <cmath> #include <sstream> -//#define DEBUG +// #define DEBUG double exponential_distribution(const int i, const double beta) { diff --git a/Filters/Extraction/vtkExpandMarkedElements.cxx b/Filters/Extraction/vtkExpandMarkedElements.cxx index 42bc0c08e62..3f8fa0bae5b 100644 --- a/Filters/Extraction/vtkExpandMarkedElements.cxx +++ b/Filters/Extraction/vtkExpandMarkedElements.cxx @@ -318,34 +318,36 @@ int vtkExpandMarkedElements::RequestData( // exchange bounding boxes to determine neighbours; helps avoid all_to_all // communication. vtkLogStartScope(TRACE, "populate block neighbours"); - diy::all_to_all(master, assigner, [](BlockT* b, const diy::ReduceProxy& rp) { - double bds[6]; - b->Dataset->GetBounds(bds); - const vtkBoundingBox bbox(bds); - if (rp.round() == 0) + diy::all_to_all(master, assigner, + [](BlockT* b, const diy::ReduceProxy& rp) { - for (int i = 0; i < rp.out_link().size(); ++i) + double bds[6]; + b->Dataset->GetBounds(bds); + const vtkBoundingBox bbox(bds); + if (rp.round() == 0) { - const auto dest = rp.out_link().target(i); - rp.enqueue(dest, bds, 6); + for (int i = 0; i < rp.out_link().size(); ++i) + { + const auto dest = rp.out_link().target(i); + rp.enqueue(dest, bds, 6); + } } - } - else - { - for (int i = 0; i < rp.in_link().size(); ++i) + else { - const auto src = rp.in_link().target(i); - double in_bds[6]; - rp.dequeue(src, in_bds, 6); - vtkBoundingBox in_bbx(in_bds); - if (src.gid != rp.gid() && in_bbx.IsValid() && in_bbx.Intersects(bbox)) + for (int i = 0; i < rp.in_link().size(); ++i) { - vtkLogF(TRACE, "%d --> %d", rp.gid(), src.gid); - b->Neighbors.emplace_back(src, in_bbx); + const auto src = rp.in_link().target(i); + double in_bds[6]; + rp.dequeue(src, in_bds, 6); + vtkBoundingBox in_bbx(in_bds); + if (src.gid != rp.gid() && in_bbx.IsValid() && in_bbx.Intersects(bbox)) + { + vtkLogF(TRACE, "%d --> %d", rp.gid(), src.gid); + b->Neighbors.emplace_back(src, in_bbx); + } } } - } - }); + }); // update local links. for (int cc = 0; cc < static_cast<int>(gids.size()); ++cc) @@ -366,29 +368,31 @@ int vtkExpandMarkedElements::RequestData( // Expand the selection for (int round = 0; round < this->NumberOfLayers; ++round) { - master.foreach ([&assoc, &round](BlockT* b, const diy::Master::ProxyWithLink& cp) { - b->EnqueueAndExpand(assoc, round, cp); - }); + master.foreach ([&assoc, &round](BlockT* b, const diy::Master::ProxyWithLink& cp) + { b->EnqueueAndExpand(assoc, round, cp); }); master.exchange(); - master.foreach ([&assoc, &round](BlockT* b, const diy::Master::ProxyWithLink& cp) { - b->DequeueAndExpand(assoc, round, cp); - }); + master.foreach ([&assoc, &round](BlockT* b, const diy::Master::ProxyWithLink& cp) + { b->DequeueAndExpand(assoc, round, cp); }); } // Remove unwanted layers - master.foreach ([this](BlockT* b, const diy::Master::ProxyWithLink&) { - b->RemoveExcedentLayers( - this->RemoveSeed, this->RemoveIntermediateLayers, this->NumberOfLayers - 1); - }); + master.foreach ( + [this](BlockT* b, const diy::Master::ProxyWithLink&) + { + b->RemoveExcedentLayers( + this->RemoveSeed, this->RemoveIntermediateLayers, this->NumberOfLayers - 1); + }); if (arrayname.empty()) { arrayname = "MarkedElements"; } - master.foreach ([&assoc, &arrayname](BlockT* b, const diy::Master::ProxyWithLink&) { - b->MarkedArray->SetName(arrayname.c_str()); - b->Dataset->GetAttributes(assoc)->AddArray(b->MarkedArray); - }); + master.foreach ( + [&assoc, &arrayname](BlockT* b, const diy::Master::ProxyWithLink&) + { + b->MarkedArray->SetName(arrayname.c_str()); + b->Dataset->GetAttributes(assoc)->AddArray(b->MarkedArray); + }); comm.barrier(); this->CheckAbort(); diff --git a/Filters/Extraction/vtkExtractSelection.cxx b/Filters/Extraction/vtkExtractSelection.cxx index 80c9f3ec99b..950ebb93ba6 100644 --- a/Filters/Extraction/vtkExtractSelection.cxx +++ b/Filters/Extraction/vtkExtractSelection.cxx @@ -187,12 +187,14 @@ namespace void InvertSelection(vtkSignedCharArray* array) { const vtkIdType n = array->GetNumberOfTuples(); - vtkSMPTools::For(0, n, [&array](vtkIdType start, vtkIdType end) { - for (vtkIdType i = start; i < end; ++i) + vtkSMPTools::For(0, n, + [&array](vtkIdType start, vtkIdType end) { - array->SetValue(i, static_cast<signed char>(array->GetValue(i) * -1 + 1)); - } - }); + for (vtkIdType i = start; i < end; ++i) + { + array->SetValue(i, static_cast<signed char>(array->GetValue(i) * -1 + 1)); + } + }); } //---------------------------------------------------------------------------- @@ -750,7 +752,8 @@ vtkSmartPointer<vtkDataObject> vtkExtractSelection::ExtractElements(vtkDataObjec vtkNew<vtkBitArray> mask; mask->SetNumberOfComponents(1); mask->SetNumberOfTuples(insidednessArray->GetNumberOfTuples()); - auto masking = [&mask, &insidednessArray](vtkIdType begin, vtkIdType end) { + auto masking = [&mask, &insidednessArray](vtkIdType begin, vtkIdType end) + { for (vtkIdType iMask = begin; iMask < end; ++iMask) { mask->SetValue(iMask, static_cast<int>(insidednessArray->GetValue(iMask) == 0)); @@ -764,7 +767,8 @@ vtkSmartPointer<vtkDataObject> vtkExtractSelection::ExtractElements(vtkDataObjec if (htg->HasMask()) { auto originalMask = htg->GetMask(); - auto maskOring = [&mask, &originalMask](vtkIdType begin, vtkIdType end) { + auto maskOring = [&mask, &originalMask](vtkIdType begin, vtkIdType end) + { for (vtkIdType iMask = begin; iMask < end; ++iMask) { if (originalMask->GetValue(iMask)) @@ -898,24 +902,28 @@ void vtkExtractSelection::ExtractSelectedCells( originalPointIds->SetNumberOfComponents(1); originalPointIds->SetName("vtkOriginalPointIds"); originalPointIds->SetNumberOfTuples(numPts); - vtkSMPTools::For(0, numPts, [&](vtkIdType begin, vtkIdType end) { - for (vtkIdType ptId = begin; ptId < end; ++ptId) + vtkSMPTools::For(0, numPts, + [&](vtkIdType begin, vtkIdType end) { - originalPointIds->SetValue(ptId, ptId); - } - }); + for (vtkIdType ptId = begin; ptId < end; ++ptId) + { + originalPointIds->SetValue(ptId, ptId); + } + }); input->GetPointData()->AddArray(originalPointIds); vtkNew<vtkIdTypeArray> originalCellIds; originalCellIds->SetNumberOfComponents(1); originalCellIds->SetName("vtkOriginalCellIds"); originalCellIds->SetNumberOfTuples(numCells); - vtkSMPTools::For(0, numCells, [&](vtkIdType begin, vtkIdType end) { - for (vtkIdType cellId = begin; cellId < end; ++cellId) + vtkSMPTools::For(0, numCells, + [&](vtkIdType begin, vtkIdType end) { - originalCellIds->SetValue(cellId, cellId); - } - }); + for (vtkIdType cellId = begin; cellId < end; ++cellId) + { + originalCellIds->SetValue(cellId, cellId); + } + }); input->GetCellData()->AddArray(originalCellIds); vtkNew<vtkExtractCells> extractor; @@ -999,27 +1007,31 @@ void vtkExtractSelection::ExtractSelectedPoints( const vtkIdType numNewPts = ids->GetNumberOfIds(); // copy points newPts->SetNumberOfPoints(numNewPts); - vtkSMPTools::For(0, numNewPts, [&](vtkIdType begin, vtkIdType end) { - double point[3]; - auto idsPtr = ids->GetPointer(0); - for (vtkIdType ptId = begin; ptId < end; ++ptId) + vtkSMPTools::For(0, numNewPts, + [&](vtkIdType begin, vtkIdType end) { - input->GetPoint(idsPtr[ptId], point); - newPts->SetPoint(ptId, point); - } - }); + double point[3]; + auto idsPtr = ids->GetPointer(0); + for (vtkIdType ptId = begin; ptId < end; ++ptId) + { + input->GetPoint(idsPtr[ptId], point); + newPts->SetPoint(ptId, point); + } + }); // copy point data outputPD->SetNumberOfTuples(numNewPts); outputPD->CopyData(pd, ids); // set original point ids originalPointIds->SetNumberOfTuples(numNewPts); - vtkSMPTools::For(0, numNewPts, [&](vtkIdType begin, vtkIdType end) { - auto idsPtr = ids->GetPointer(0); - for (vtkIdType ptId = begin; ptId < end; ++ptId) + vtkSMPTools::For(0, numNewPts, + [&](vtkIdType begin, vtkIdType end) { - originalPointIds->SetValue(ptId, idsPtr[ptId]); - } - }); + auto idsPtr = ids->GetPointer(0); + for (vtkIdType ptId = begin; ptId < end; ++ptId) + { + originalPointIds->SetValue(ptId, idsPtr[ptId]); + } + }); } else { @@ -1031,25 +1043,29 @@ void vtkExtractSelection::ExtractSelectedPoints( else { newPts->SetNumberOfPoints(numPts); - vtkSMPTools::For(0, numPts, [&](vtkIdType beginPtId, vtkIdType endPtId) { - double x[3]; - for (vtkIdType ptId = beginPtId; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, numPts, + [&](vtkIdType beginPtId, vtkIdType endPtId) { - input->GetPoint(ptId, x); - newPts->SetPoint(ptId, x); - } - }); + double x[3]; + for (vtkIdType ptId = beginPtId; ptId < endPtId; ++ptId) + { + input->GetPoint(ptId, x); + newPts->SetPoint(ptId, x); + } + }); } // copy point data outputPD->PassData(pd); // set original point ids originalPointIds->SetNumberOfTuples(numPts); - vtkSMPTools::For(0, numPts, [&](vtkIdType beginPtId, vtkIdType endPtId) { - for (vtkIdType ptId = beginPtId; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, numPts, + [&](vtkIdType beginPtId, vtkIdType endPtId) { - originalPointIds->SetValue(ptId, ptId); - } - }); + for (vtkIdType ptId = beginPtId; ptId < endPtId; ++ptId) + { + originalPointIds->SetValue(ptId, ptId); + } + }); } output->SetPoints(newPts); @@ -1058,21 +1074,25 @@ void vtkExtractSelection::ExtractSelectedPoints( // create connectivity array vtkNew<vtkIdTypeArray> connectivity; connectivity->SetNumberOfValues(newNumPts); - vtkSMPTools::For(0, newNumPts, [&](vtkIdType beginPtId, vtkIdType endPtId) { - for (vtkIdType ptId = beginPtId; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, newNumPts, + [&](vtkIdType beginPtId, vtkIdType endPtId) { - connectivity->SetValue(ptId, ptId); - } - }); + for (vtkIdType ptId = beginPtId; ptId < endPtId; ++ptId) + { + connectivity->SetValue(ptId, ptId); + } + }); // create offsets array vtkNew<vtkIdTypeArray> offsets; offsets->SetNumberOfValues(newNumPts + 1); - vtkSMPTools::For(0, newNumPts + 1, [&](vtkIdType begin, vtkIdType end) { - for (vtkIdType i = begin; i < end; i++) + vtkSMPTools::For(0, newNumPts + 1, + [&](vtkIdType begin, vtkIdType end) { - offsets->SetValue(i, i); - } - }); + for (vtkIdType i = begin; i < end; i++) + { + offsets->SetValue(i, i); + } + }); // create cell array vtkNew<vtkCellArray> cells; cells->SetData(offsets, connectivity); @@ -1115,12 +1135,14 @@ void vtkExtractSelection::ExtractSelectedRows( { output->ShallowCopy(input); originalRowIds->SetNumberOfTuples(numRows); - vtkSMPTools::For(0, numRows, [&](vtkIdType beginRowId, vtkIdType endRowId) { - for (vtkIdType rowId = beginRowId; rowId < endRowId; ++rowId) + vtkSMPTools::For(0, numRows, + [&](vtkIdType beginRowId, vtkIdType endRowId) { - originalRowIds->SetValue(rowId, rowId); - } - }); + for (vtkIdType rowId = beginRowId; rowId < endRowId; ++rowId) + { + originalRowIds->SetValue(rowId, rowId); + } + }); } output->AddColumn(originalRowIds); } diff --git a/Filters/Extraction/vtkExtractTensorComponents.cxx b/Filters/Extraction/vtkExtractTensorComponents.cxx index 4a6777bbfad..779718002ff 100644 --- a/Filters/Extraction/vtkExtractTensorComponents.cxx +++ b/Filters/Extraction/vtkExtractTensorComponents.cxx @@ -168,100 +168,102 @@ int vtkExtractTensorComponents::RequestData(vtkInformation* vtkNotUsed(request), // Loop over all points extracting components of tensor as directed. Use a // lambda function. // - vtkSMPTools::For(0, numPts, [&](vtkIdType ptId, vtkIdType endPtId) { - double tensor[9]; - double s = 0.0; - double v[3]; - double sx, sy, sz, txy, tyz, txz; - bool isFirst = vtkSMPTools::GetSingleThread(); - vtkIdType checkAbortInterval = std::min((endPtId - ptId) / 10 + 1, (vtkIdType)1000); - - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, numPts, + [&](vtkIdType ptId, vtkIdType endPtId) { - if (ptId % checkAbortInterval == 0) + double tensor[9]; + double s = 0.0; + double v[3]; + double sx, sy, sz, txy, tyz, txz; + bool isFirst = vtkSMPTools::GetSingleThread(); + vtkIdType checkAbortInterval = std::min((endPtId - ptId) / 10 + 1, (vtkIdType)1000); + + for (; ptId < endPtId; ++ptId) { - if (isFirst) + if (ptId % checkAbortInterval == 0) { - this->CheckAbort(); + if (isFirst) + { + this->CheckAbort(); + } + if (this->GetAbortOutput()) + { + break; + } } - if (this->GetAbortOutput()) - { - break; - } - } - - inTensors->GetTuple(ptId, tensor); - if (inTensors->GetNumberOfComponents() == 6) - { - vtkMath::TensorFromSymmetricTensor(tensor); - } - if (this->ExtractScalars) - { - if (this->ScalarMode == VTK_EXTRACT_EFFECTIVE_STRESS) + inTensors->GetTuple(ptId, tensor); + if (inTensors->GetNumberOfComponents() == 6) { - sx = tensor[0]; - sy = tensor[4]; - sz = tensor[8]; - txy = tensor[3]; - tyz = tensor[7]; - txz = tensor[6]; - - s = sqrt(0.16666667 * - ((sx - sy) * (sx - sy) + (sy - sz) * (sy - sz) + (sz - sx) * (sz - sx) + - 6.0 * (txy * txy + tyz * tyz + txz * txz))); + vtkMath::TensorFromSymmetricTensor(tensor); } - else if (this->ScalarMode == VTK_EXTRACT_COMPONENT) + if (this->ExtractScalars) { - s = tensor[this->ScalarComponents[0] + 3 * this->ScalarComponents[1]]; - } - - else if (this->ScalarMode == VTK_EXTRACT_DETERMINANT) + if (this->ScalarMode == VTK_EXTRACT_EFFECTIVE_STRESS) + { + sx = tensor[0]; + sy = tensor[4]; + sz = tensor[8]; + txy = tensor[3]; + tyz = tensor[7]; + txz = tensor[6]; + + s = sqrt(0.16666667 * + ((sx - sy) * (sx - sy) + (sy - sz) * (sy - sz) + (sz - sx) * (sz - sx) + + 6.0 * (txy * txy + tyz * tyz + txz * txz))); + } + + else if (this->ScalarMode == VTK_EXTRACT_COMPONENT) + { + s = tensor[this->ScalarComponents[0] + 3 * this->ScalarComponents[1]]; + } + + else if (this->ScalarMode == VTK_EXTRACT_DETERMINANT) + { + s = tensor[0] * tensor[4] * tensor[8] - tensor[0] * tensor[5] * tensor[7] - + tensor[1] * tensor[3] * tensor[8] + tensor[1] * tensor[5] * tensor[6] + + tensor[2] * tensor[3] * tensor[7] - tensor[2] * tensor[4] * tensor[6]; + } + else if (this->ScalarMode == VTK_EXTRACT_NONNEGATIVE_DETERMINANT) + { + s = fabs(tensor[0] * tensor[4] * tensor[8] - tensor[0] * tensor[5] * tensor[7] - + tensor[1] * tensor[3] * tensor[8] + tensor[1] * tensor[5] * tensor[6] + + tensor[2] * tensor[3] * tensor[7] - tensor[2] * tensor[4] * tensor[6]); + } + else // if ( this->ScalarMode == VTK_EXTRACT_TRACE ) + { + s = tensor[0] + tensor[4] + tensor[8]; + } + newScalars->SetTuple(ptId, &s); + } // if extract scalars + + if (this->ExtractVectors) { - s = tensor[0] * tensor[4] * tensor[8] - tensor[0] * tensor[5] * tensor[7] - - tensor[1] * tensor[3] * tensor[8] + tensor[1] * tensor[5] * tensor[6] + - tensor[2] * tensor[3] * tensor[7] - tensor[2] * tensor[4] * tensor[6]; + v[0] = tensor[this->VectorComponents[0] + 3 * this->VectorComponents[1]]; + v[1] = tensor[this->VectorComponents[2] + 3 * this->VectorComponents[3]]; + v[2] = tensor[this->VectorComponents[4] + 3 * this->VectorComponents[5]]; + newVectors->SetTuple(ptId, v); } - else if (this->ScalarMode == VTK_EXTRACT_NONNEGATIVE_DETERMINANT) - { - s = fabs(tensor[0] * tensor[4] * tensor[8] - tensor[0] * tensor[5] * tensor[7] - - tensor[1] * tensor[3] * tensor[8] + tensor[1] * tensor[5] * tensor[6] + - tensor[2] * tensor[3] * tensor[7] - tensor[2] * tensor[4] * tensor[6]); - } - else // if ( this->ScalarMode == VTK_EXTRACT_TRACE ) + + if (this->ExtractNormals) { - s = tensor[0] + tensor[4] + tensor[8]; + v[0] = tensor[this->NormalComponents[0] + 3 * this->NormalComponents[1]]; + v[1] = tensor[this->NormalComponents[2] + 3 * this->NormalComponents[3]]; + v[2] = tensor[this->NormalComponents[4] + 3 * this->NormalComponents[5]]; + newNormals->SetTuple(ptId, v); } - newScalars->SetTuple(ptId, &s); - } // if extract scalars - - if (this->ExtractVectors) - { - v[0] = tensor[this->VectorComponents[0] + 3 * this->VectorComponents[1]]; - v[1] = tensor[this->VectorComponents[2] + 3 * this->VectorComponents[3]]; - v[2] = tensor[this->VectorComponents[4] + 3 * this->VectorComponents[5]]; - newVectors->SetTuple(ptId, v); - } - if (this->ExtractNormals) - { - v[0] = tensor[this->NormalComponents[0] + 3 * this->NormalComponents[1]]; - v[1] = tensor[this->NormalComponents[2] + 3 * this->NormalComponents[3]]; - v[2] = tensor[this->NormalComponents[4] + 3 * this->NormalComponents[5]]; - newNormals->SetTuple(ptId, v); - } - - if (this->ExtractTCoords) - { - for (int i = 0; i < this->NumberOfTCoords; i++) + if (this->ExtractTCoords) { - v[i] = tensor[this->TCoordComponents[2 * i] + 3 * this->TCoordComponents[2 * i + 1]]; + for (int i = 0; i < this->NumberOfTCoords; i++) + { + v[i] = tensor[this->TCoordComponents[2 * i] + 3 * this->TCoordComponents[2 * i + 1]]; + } + newTCoords->SetTuple(ptId, v); } - newTCoords->SetTuple(ptId, v); - } - } // for all points in this batch - }); // end lambda + } // for all points in this batch + }); // end lambda // Send data to output // diff --git a/Filters/Extraction/vtkFrustumSelector.cxx b/Filters/Extraction/vtkFrustumSelector.cxx index 8ade291df29..f16d0b4c843 100644 --- a/Filters/Extraction/vtkFrustumSelector.cxx +++ b/Filters/Extraction/vtkFrustumSelector.cxx @@ -658,7 +658,8 @@ public: // do this by checking if there is a plane for which all the points in the cell // are a positive distance away from it std::vector<double> distances(cell->GetNumberOfPoints()); - auto checkAllPositive = [](std::vector<double>& vals) { + auto checkAllPositive = [](std::vector<double>& vals) + { for (auto val : vals) { if (val < 0) @@ -719,7 +720,8 @@ public: cell->PointIds->SetId(iP, iP); } - auto cubePoint = [dim, origin, size](std::bitset<3>& pos, std::vector<double>* cubePt) { + auto cubePoint = [dim, origin, size](std::bitset<3>& pos, std::vector<double>* cubePt) + { for (unsigned int d = 0; d < dim; d++) { cubePt->at(d) = origin[d] + pos[d] * size[d]; @@ -925,21 +927,23 @@ void vtkFrustumSelector::ComputeSelectedPoints(vtkDataSet* input, vtkSignedCharA double xx[3]; input->GetPoint(0, xx); - vtkSMPTools::For(0, numPts, [input, this, &pointSelected](vtkIdType begin, vtkIdType end) { - double x[3]; - for (vtkIdType ptId = begin; ptId < end; ++ptId) + vtkSMPTools::For(0, numPts, + [input, this, &pointSelected](vtkIdType begin, vtkIdType end) { - input->GetPoint(ptId, x); - if ((this->Frustum->EvaluateFunction(x)) < 0.0) + double x[3]; + for (vtkIdType ptId = begin; ptId < end; ++ptId) { - pointSelected->SetValue(ptId, 1); - } - else - { - pointSelected->SetValue(ptId, 0); + input->GetPoint(ptId, x); + if ((this->Frustum->EvaluateFunction(x)) < 0.0) + { + pointSelected->SetValue(ptId, 1); + } + else + { + pointSelected->SetValue(ptId, 0); + } } - } - }); + }); } //------------------------------------------------------------------------------ diff --git a/Filters/Extraction/vtkSelector.cxx b/Filters/Extraction/vtkSelector.cxx index beee9210e8a..a299b21bf5b 100644 --- a/Filters/Extraction/vtkSelector.cxx +++ b/Filters/Extraction/vtkSelector.cxx @@ -351,26 +351,28 @@ vtkSmartPointer<vtkSignedCharArray> vtkSelector::ComputeCellsContainingSelectedP } // run through cells and accept those with any point inside - vtkSMPTools::For(0, numCells, [&](vtkIdType first, vtkIdType last) { - vtkNew<vtkIdList> cellPts; - vtkIdType numCellPts; - const vtkIdType* pts; - signed char selectedPointFound; - for (vtkIdType cellId = first; cellId < last; ++cellId) + vtkSMPTools::For(0, numCells, + [&](vtkIdType first, vtkIdType last) { - dataset->GetCellPoints(cellId, numCellPts, pts, cellPts); - selectedPointFound = 0; - for (vtkIdType i = 0; i < numCellPts; ++i) + vtkNew<vtkIdList> cellPts; + vtkIdType numCellPts; + const vtkIdType* pts; + signed char selectedPointFound; + for (vtkIdType cellId = first; cellId < last; ++cellId) { - if (selectedPoints->GetValue(pts[i]) != 0) + dataset->GetCellPoints(cellId, numCellPts, pts, cellPts); + selectedPointFound = 0; + for (vtkIdType i = 0; i < numCellPts; ++i) { - selectedPointFound = 1; - break; + if (selectedPoints->GetValue(pts[i]) != 0) + { + selectedPointFound = 1; + break; + } } + selectedCells->SetValue(cellId, selectedPointFound); } - selectedCells->SetValue(cellId, selectedPointFound); - } - }); + }); return selectedCells; } diff --git a/Filters/Extraction/vtkValueSelector.cxx b/Filters/Extraction/vtkValueSelector.cxx index a3fd641d6df..3934161ec05 100644 --- a/Filters/Extraction/vtkValueSelector.cxx +++ b/Filters/Extraction/vtkValueSelector.cxx @@ -83,35 +83,40 @@ struct ArrayValueMatchFunctor VTK_ASSUME(insidednessArray->GetNumberOfTuples() == fArray->GetNumberOfTuples()); if (comp >= 0) { - vtkSMPTools::For(0, fArray->GetNumberOfTuples(), [=](vtkIdType begin, vtkIdType end) { - const auto fRange = vtk::DataArrayTupleRange(fArray, begin, end); - auto insideRange = vtk::DataArrayValueRange<1>(insidednessArray, begin, end); - auto insideIter = insideRange.begin(); - for (auto i = fRange.cbegin(); i != fRange.cend(); ++i, ++insideIter) + vtkSMPTools::For(0, fArray->GetNumberOfTuples(), + [=](vtkIdType begin, vtkIdType end) { - auto result = std::binary_search(haystack_begin, haystack_end, (*i)[comp]); - *insideIter = result ? 1 : 0; - } - }); + const auto fRange = vtk::DataArrayTupleRange(fArray, begin, end); + auto insideRange = vtk::DataArrayValueRange<1>(insidednessArray, begin, end); + auto insideIter = insideRange.begin(); + for (auto i = fRange.cbegin(); i != fRange.cend(); ++i, ++insideIter) + { + auto result = std::binary_search(haystack_begin, haystack_end, (*i)[comp]); + *insideIter = result ? 1 : 0; + } + }); } else { // compare vector magnitude. - vtkSMPTools::For(0, fArray->GetNumberOfTuples(), [=](vtkIdType begin, vtkIdType end) { - const auto fRange = vtk::DataArrayTupleRange(fArray, begin, end); - auto insideRange = vtk::DataArrayValueRange<1>(insidednessArray, begin, end); - using FTupleCRefType = typename decltype(fRange)::ConstTupleReferenceType; - std::transform(fRange.cbegin(), fRange.cend(), insideRange.begin(), - [&](FTupleCRefType fTuple) -> signed char { - ValueType val = ValueType(0); - for (const ValueType fComp : fTuple) + vtkSMPTools::For(0, fArray->GetNumberOfTuples(), + [=](vtkIdType begin, vtkIdType end) + { + const auto fRange = vtk::DataArrayTupleRange(fArray, begin, end); + auto insideRange = vtk::DataArrayValueRange<1>(insidednessArray, begin, end); + using FTupleCRefType = typename decltype(fRange)::ConstTupleReferenceType; + std::transform(fRange.cbegin(), fRange.cend(), insideRange.begin(), + [&](FTupleCRefType fTuple) -> signed char { - val += fComp * fComp; - } - const auto mag = static_cast<ValueType>(std::sqrt(val)); - return std::binary_search(haystack_begin, haystack_end, mag) ? 1 : 0; - }); - }); + ValueType val = ValueType(0); + for (const ValueType fComp : fTuple) + { + val += fComp * fComp; + } + const auto mag = static_cast<ValueType>(std::sqrt(val)); + return std::binary_search(haystack_begin, haystack_end, mag) ? 1 : 0; + }); + }); } } @@ -126,13 +131,15 @@ struct ArrayValueMatchFunctor const auto selRange = vtk::DataArrayValueRange<1>(selList); this->InsidednessArray->FillValue(0); - std::for_each(selRange.cbegin(), selRange.cend(), [&](const T selVal) { - const auto cid = static_cast<vtkIdType>(selVal); - if (cid >= 0 && cid < numDataValues) + std::for_each(selRange.cbegin(), selRange.cend(), + [&](const T selVal) { - this->InsidednessArray->SetValue(cid, 1); - } - }); + const auto cid = static_cast<vtkIdType>(selVal); + if (cid >= 0 && cid < numDataValues) + { + this->InsidednessArray->SetValue(cid, 1); + } + }); } }; @@ -169,7 +176,8 @@ struct ArrayValueRangeFunctor if (comp >= 0) { vtkSMPTools::For(0, fArray->GetNumberOfTuples(), - [this, comp, fArray, selList](vtkIdType begin, vtkIdType end) { + [this, comp, fArray, selList](vtkIdType begin, vtkIdType end) + { const auto fRange = vtk::DataArrayTupleRange(fArray, begin, end); const auto selRange = vtk::DataArrayTupleRange<2>(selList); auto insideRange = vtk::DataArrayValueRange<1>(this->InsidednessArray, begin, end); @@ -190,8 +198,9 @@ struct ArrayValueRangeFunctor else { // compare vector magnitude. - vtkSMPTools::For( - 0, fArray->GetNumberOfTuples(), [this, fArray, selList](vtkIdType begin, vtkIdType end) { + vtkSMPTools::For(0, fArray->GetNumberOfTuples(), + [this, fArray, selList](vtkIdType begin, vtkIdType end) + { const auto fRange = vtk::DataArrayTupleRange(fArray, begin, end); const auto selRange = vtk::DataArrayTupleRange<2>(selList); auto insideRange = vtk::DataArrayValueRange<1>(this->InsidednessArray, begin, end); @@ -371,43 +380,48 @@ private: if (comp >= 0) { - vtkSMPTools::For(0, darray->GetNumberOfTuples(), [=](vtkIdType begin, vtkIdType end) { - for (vtkIdType cc = begin; cc < end; ++cc) + vtkSMPTools::For(0, darray->GetNumberOfTuples(), + [=](vtkIdType begin, vtkIdType end) { - const auto val = darray->GetComponent(cc, comp); - bool match = false; - for (vtkIdType r = 0; r < numRanges && !match; ++r) + for (vtkIdType cc = begin; cc < end; ++cc) { - match = (val >= selList->GetComponent(r, 0) && val <= selList->GetComponent(r, 1)); + const auto val = darray->GetComponent(cc, comp); + bool match = false; + for (vtkIdType r = 0; r < numRanges && !match; ++r) + { + match = + (val >= selList->GetComponent(r, 0) && val <= selList->GetComponent(r, 1)); + } + insidednessArray->SetValue(cc, match ? 1 : 0); } - insidednessArray->SetValue(cc, match ? 1 : 0); - } - }); + }); } else { const int num_components = darray->GetNumberOfComponents(); // compare vector magnitude. - vtkSMPTools::For(0, darray->GetNumberOfTuples(), [=](vtkIdType begin, vtkIdType end) { - for (vtkIdType cc = begin; cc < end; ++cc) + vtkSMPTools::For(0, darray->GetNumberOfTuples(), + [=](vtkIdType begin, vtkIdType end) { - double val = double(0); - for (int kk = 0; kk < num_components; ++kk) + for (vtkIdType cc = begin; cc < end; ++cc) { - const auto valKK = darray->GetComponent(cc, comp); - val += valKK * valKK; + double val = double(0); + for (int kk = 0; kk < num_components; ++kk) + { + const auto valKK = darray->GetComponent(cc, comp); + val += valKK * valKK; + } + const auto magnitude = std::sqrt(val); + bool match = false; + for (vtkIdType r = 0; r < numRanges && !match; ++r) + { + match = (magnitude >= selList->GetComponent(r, 0) && + magnitude <= selList->GetComponent(r, 1)); + } + insidednessArray->SetValue(cc, match ? 1 : 0); } - const auto magnitude = std::sqrt(val); - bool match = false; - for (vtkIdType r = 0; r < numRanges && !match; ++r) - { - match = (magnitude >= selList->GetComponent(r, 0) && - magnitude <= selList->GetComponent(r, 1)); - } - insidednessArray->SetValue(cc, match ? 1 : 0); - } - }); + }); } } } diff --git a/Filters/FlowPaths/Testing/Cxx/TestBSPTree.cxx b/Filters/FlowPaths/Testing/Cxx/TestBSPTree.cxx index 0a5fca7b153..5e39250120c 100644 --- a/Filters/FlowPaths/Testing/Cxx/TestBSPTree.cxx +++ b/Filters/FlowPaths/Testing/Cxx/TestBSPTree.cxx @@ -35,7 +35,7 @@ #include "vtkSelectionNode.h" #include "vtkSelectionSource.h" -//#define TESTING_LOOP +// #define TESTING_LOOP int TestBSPTree(int argc, char* argv[]) { diff --git a/Filters/FlowPaths/Testing/Cxx/TestParallelVectors.cxx b/Filters/FlowPaths/Testing/Cxx/TestParallelVectors.cxx index 015717f08ac..59214c55d4a 100644 --- a/Filters/FlowPaths/Testing/Cxx/TestParallelVectors.cxx +++ b/Filters/FlowPaths/Testing/Cxx/TestParallelVectors.cxx @@ -76,7 +76,8 @@ vtkSmartPointer<vtkUnstructuredGrid> constructGrid(int nX, int nY, int nZ, GridT p[7][2] += dz; auto addTetra = [](const double* p0, const double* p1, const double* p2, const double* p3, - vtkPointLocator* pl, vtkCellArray* cells) { + vtkPointLocator* pl, vtkCellArray* cells) + { vtkSmartPointer<vtkTetra> t = vtkSmartPointer<vtkTetra>::New(); static vtkIdType bIndices[4][4] = { { 0, 0, 0, 1 }, { 1, 0, 0, 0 }, { 0, 1, 0, 0 }, { 0, 0, 1, 0 } }; @@ -105,7 +106,8 @@ vtkSmartPointer<vtkUnstructuredGrid> constructGrid(int nX, int nY, int nZ, GridT cells->InsertNextCell(t); }; - auto addHex = [](double pts[8][3], vtkPointLocator* pl, vtkCellArray* cells) { + auto addHex = [](double pts[8][3], vtkPointLocator* pl, vtkCellArray* cells) + { vtkSmartPointer<vtkHexahedron> h = vtkSmartPointer<vtkHexahedron>::New(); vtkIdType nPoints = 8; @@ -193,14 +195,16 @@ void constructFieldProfile(vtkUnstructuredGrid* unstructuredGrid) { const double z0 = -1.5; - auto f = [=](const double& t) -> std::array<double, 2> { + auto f = [=](const double& t) -> std::array<double, 2> + { const double amplitude = .8; const double phase = 2.; return { amplitude * cos(2. * M_PI * t / phase), amplitude * sin(2. * M_PI * t / phase) }; }; - auto v = [=](const double p[3]) -> std::array<double, 3> { + auto v = [=](const double p[3]) -> std::array<double, 3> + { const double& x = p[0]; const double& y = p[1]; const double& z = p[2]; @@ -211,7 +215,8 @@ void constructFieldProfile(vtkUnstructuredGrid* unstructuredGrid) return { x - f_t[0], y - f_t[1], t }; }; - auto w = [=](const double p[3]) -> std::array<double, 3> { + auto w = [=](const double p[3]) -> std::array<double, 3> + { const double& x = p[0]; const double& y = p[1]; const double& z = p[2]; diff --git a/Filters/FlowPaths/Testing/Cxx/TestParticleTracers.cxx b/Filters/FlowPaths/Testing/Cxx/TestParticleTracers.cxx index 2865b0bdb22..a2380bd173c 100644 --- a/Filters/FlowPaths/Testing/Cxx/TestParticleTracers.cxx +++ b/Filters/FlowPaths/Testing/Cxx/TestParticleTracers.cxx @@ -45,7 +45,8 @@ bool Execute(vtkAlgorithm* input, vtkPolyData* seeds, vtkSmartPointer<vtkDataObj int TestParticleTracers(int argc, char* argv[]) { - auto getBaseline = [&](std::string&& name) { + auto getBaseline = [&](std::string&& name) + { vtkNew<vtkXMLPolyDataReader> reader; reader->SetFileName(vtkTestUtilities::ExpandDataFileName( argc, argv, (std::string("Data/ParticleTracers/") + name).c_str())); diff --git a/Filters/FlowPaths/Testing/Cxx/TestVortexCore.cxx b/Filters/FlowPaths/Testing/Cxx/TestVortexCore.cxx index f46562b85bf..4fe4c7cb15e 100644 --- a/Filters/FlowPaths/Testing/Cxx/TestVortexCore.cxx +++ b/Filters/FlowPaths/Testing/Cxx/TestVortexCore.cxx @@ -64,7 +64,8 @@ vtkSmartPointer<vtkUnstructuredGrid> constructGrid(int nX, int nY, int nZ, GridT p[7][2] += dz; auto addTetra = [](const double* p0, const double* p1, const double* p2, const double* p3, - vtkPointLocator* pl, vtkCellArray* cells) { + vtkPointLocator* pl, vtkCellArray* cells) + { vtkSmartPointer<vtkTetra> t = vtkSmartPointer<vtkTetra>::New(); static vtkIdType bIndices[4][4] = { { 0, 0, 0, 1 }, { 1, 0, 0, 0 }, { 0, 1, 0, 0 }, { 0, 0, 1, 0 } }; @@ -93,7 +94,8 @@ vtkSmartPointer<vtkUnstructuredGrid> constructGrid(int nX, int nY, int nZ, GridT cells->InsertNextCell(t); }; - auto addHex = [](double pts[8][3], vtkPointLocator* pl, vtkCellArray* cells) { + auto addHex = [](double pts[8][3], vtkPointLocator* pl, vtkCellArray* cells) + { vtkSmartPointer<vtkHexahedron> h = vtkSmartPointer<vtkHexahedron>::New(); vtkIdType nPoints = 8; @@ -179,7 +181,8 @@ vtkSmartPointer<vtkUnstructuredGrid> constructGrid(int nX, int nY, int nZ, GridT void constructVelocityProfile(vtkUnstructuredGrid* unstructuredGrid) { - auto velocity = [](const double p[3]) -> std::array<double, 3> { + auto velocity = [](const double p[3]) -> std::array<double, 3> + { const double s = .5; const double r = .5; const double k = .1; diff --git a/Filters/FlowPaths/vtkLinearTransformCellLocator.cxx b/Filters/FlowPaths/vtkLinearTransformCellLocator.cxx index e5d6f3351d1..e93ac8156d9 100644 --- a/Filters/FlowPaths/vtkLinearTransformCellLocator.cxx +++ b/Filters/FlowPaths/vtkLinearTransformCellLocator.cxx @@ -125,17 +125,19 @@ struct ComputeTransformationWorker Eigen::MatrixXd p1, p2; p1.resize(3, p1Range.size()); p2.resize(3, p2Range.size()); - vtkSMPTools::For(0, p1Range.size(), [&](vtkIdType begin, vtkIdType end) { - for (vtkIdType i = begin; i < end; i++) + vtkSMPTools::For(0, p1Range.size(), + [&](vtkIdType begin, vtkIdType end) { - p1(0, i) = p1Range[i][0]; - p1(1, i) = p1Range[i][1]; - p1(2, i) = p1Range[i][2]; - p2(0, i) = p2Range[i][0]; - p2(1, i) = p2Range[i][1]; - p2(2, i) = p2Range[i][2]; - } - }); + for (vtkIdType i = begin; i < end; i++) + { + p1(0, i) = p1Range[i][0]; + p1(1, i) = p1Range[i][1]; + p1(2, i) = p1Range[i][2]; + p2(0, i) = p2Range[i][0]; + p2(1, i) = p2Range[i][1]; + p2(2, i) = p2Range[i][2]; + } + }); // find the rotation and translation matrix between 2 sets of points Eigen::Vector3d p1BaryCenter = p1.rowwise().mean(); diff --git a/Filters/FlowPaths/vtkModifiedBSPTree.cxx b/Filters/FlowPaths/vtkModifiedBSPTree.cxx index 646ccd8517d..916c805f172 100644 --- a/Filters/FlowPaths/vtkModifiedBSPTree.cxx +++ b/Filters/FlowPaths/vtkModifiedBSPTree.cxx @@ -92,8 +92,8 @@ public: { for (int i = 0; i < 3; i++) { - delete[](this->Mins[i]); - delete[](this->Maxs[i]); + delete[] (this->Mins[i]); + delete[] (this->Maxs[i]); } global_list_count -= 1; } @@ -147,23 +147,25 @@ void vtkModifiedBSPTree::BuildLocatorInternal() // sort the cells into 6 lists using structure for subdividing tests Sorted_cell_extents_Lists* lists = new Sorted_cell_extents_Lists(numCells); - vtkSMPTools::For(0, numCells, [&](vtkIdType begin, vtkIdType end) { - double cellBounds[6], *cellBoundsPtr; - cellBoundsPtr = cellBounds; - for (uint8_t i = 0; i < 3; ++i) + vtkSMPTools::For(0, numCells, + [&](vtkIdType begin, vtkIdType end) { - for (vtkIdType j = begin; j < end; ++j) + double cellBounds[6], *cellBoundsPtr; + cellBoundsPtr = cellBounds; + for (uint8_t i = 0; i < 3; ++i) { - this->GetCellBounds(j, cellBoundsPtr); - lists->Mins[i][j].min = cellBoundsPtr[i * 2]; - lists->Mins[i][j].max = cellBoundsPtr[i * 2 + 1]; - lists->Mins[i][j].cell_ID = j; - lists->Maxs[i][j].min = cellBoundsPtr[i * 2]; - lists->Maxs[i][j].max = cellBoundsPtr[i * 2 + 1]; - lists->Maxs[i][j].cell_ID = j; + for (vtkIdType j = begin; j < end; ++j) + { + this->GetCellBounds(j, cellBoundsPtr); + lists->Mins[i][j].min = cellBoundsPtr[i * 2]; + lists->Mins[i][j].max = cellBoundsPtr[i * 2 + 1]; + lists->Mins[i][j].cell_ID = j; + lists->Maxs[i][j].min = cellBoundsPtr[i * 2]; + lists->Maxs[i][j].max = cellBoundsPtr[i * 2 + 1]; + lists->Maxs[i][j].cell_ID = j; + } } - } - }); + }); for (uint8_t i = 0; i < 3; i++) { // Sort diff --git a/Filters/FlowPaths/vtkParticlePathFilter.cxx b/Filters/FlowPaths/vtkParticlePathFilter.cxx index efbfa06d2e2..fafd09ad2c6 100644 --- a/Filters/FlowPaths/vtkParticlePathFilter.cxx +++ b/Filters/FlowPaths/vtkParticlePathFilter.cxx @@ -30,7 +30,8 @@ void FillCellArrays(vtkCellArray* verts, vtkCellArray* lines, for (const auto& pair : paths) { const auto& path = pair.second; - auto insertNextCell = [&path](ArrayType64* connectivity, ArrayType64* offsets, vtkIdType& n) { + auto insertNextCell = [&path](ArrayType64* connectivity, ArrayType64* offsets, vtkIdType& n) + { for (vtkIdType id = n; id < n + static_cast<vtkIdType>(path.size()); ++id) { connectivity->InsertNextValue(id); @@ -200,7 +201,8 @@ int vtkParticlePathFilter::Execute( // We use injectedPointIdArray to map the received paths to the paths we hold locally. for (vtkIdType pointId = 0; pointId < ps->GetNumberOfPoints(); ++pointId) { - vtkIdType id = [this, &endId] { + vtkIdType id = [this, &endId] + { if (this->UnusedIndices.empty()) { return endId++; diff --git a/Filters/FlowPaths/vtkStreaklineFilter.cxx b/Filters/FlowPaths/vtkStreaklineFilter.cxx index 0c8f6db302b..0e02bf89e40 100644 --- a/Filters/FlowPaths/vtkStreaklineFilter.cxx +++ b/Filters/FlowPaths/vtkStreaklineFilter.cxx @@ -30,7 +30,8 @@ void FillCellArrays( for (const auto& streak : streaks) { - auto insertNextCell = [&streak](ArrayT* connectivity, ArrayT* offsets, vtkIdType& n) { + auto insertNextCell = [&streak](ArrayT* connectivity, ArrayT* offsets, vtkIdType& n) + { for (vtkIdType pointId : streak) { connectivity->InsertNextValue(pointId); diff --git a/Filters/FlowPaths/vtkStreamTracer.cxx b/Filters/FlowPaths/vtkStreamTracer.cxx index 0ce06b40549..35a808835e9 100644 --- a/Filters/FlowPaths/vtkStreamTracer.cxx +++ b/Filters/FlowPaths/vtkStreamTracer.cxx @@ -1649,12 +1649,14 @@ void vtkStreamTracer::GenerateNormals(vtkPolyData* output, double* firstNormal, // Make sure the normals are initialized in case // GenerateSlidingNormals() fails and returns before // creating all normals - vtkSMPTools::For(0, numPts, [&](vtkIdType ptId, vtkIdType endPtId) { - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, numPts, + [&](vtkIdType ptId, vtkIdType endPtId) { - normals->SetTuple3(ptId, 1, 0, 0); - } - }); + for (; ptId < endPtId; ++ptId) + { + normals->SetTuple3(ptId, 1, 0, 0); + } + }); // Generate the orientation normals. This will be threaded since none of the // lines "reuse" points from another line. @@ -1671,33 +1673,35 @@ void vtkStreamTracer::GenerateNormals(vtkPolyData* output, double* firstNormal, } // Thread the final normal generation - vtkSMPTools::For(0, numPts, [&](vtkIdType ptId, vtkIdType endPtId) { - double normal[3], local1[3], local2[3], theta, costheta, sintheta, length; - double velocity[3]; - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, numPts, + [&](vtkIdType ptId, vtkIdType endPtId) { - normals->GetTuple(ptId, normal); - newVectors->GetTuple(ptId, velocity); - // obtain two unit orthogonal vectors on the plane perpendicular to - // the streamline - for (auto j = 0; j < 3; j++) - { - local1[j] = normal[j]; - } - length = vtkMath::Normalize(local1); - vtkMath::Cross(local1, velocity, local2); - vtkMath::Normalize(local2); - // Rotate the normal with theta - rotation->GetTuple(ptId, &theta); - costheta = std::cos(theta); - sintheta = std::sin(theta); - for (auto j = 0; j < 3; j++) + double normal[3], local1[3], local2[3], theta, costheta, sintheta, length; + double velocity[3]; + for (; ptId < endPtId; ++ptId) { - normal[j] = length * (costheta * local1[j] + sintheta * local2[j]); + normals->GetTuple(ptId, normal); + newVectors->GetTuple(ptId, velocity); + // obtain two unit orthogonal vectors on the plane perpendicular to + // the streamline + for (auto j = 0; j < 3; j++) + { + local1[j] = normal[j]; + } + length = vtkMath::Normalize(local1); + vtkMath::Cross(local1, velocity, local2); + vtkMath::Normalize(local2); + // Rotate the normal with theta + rotation->GetTuple(ptId, &theta); + costheta = std::cos(theta); + sintheta = std::sin(theta); + for (auto j = 0; j < 3; j++) + { + normal[j] = length * (costheta * local1[j] + sintheta * local2[j]); + } + normals->SetTuple(ptId, normal); } - normals->SetTuple(ptId, normal); - } - }); // lambda + }); // lambda // Associate normals with the output outputPD->AddArray(normals); diff --git a/Filters/General/vtkAnimateModes.cxx b/Filters/General/vtkAnimateModes.cxx index 845f73b9af5..8870d08addd 100644 --- a/Filters/General/vtkAnimateModes.cxx +++ b/Filters/General/vtkAnimateModes.cxx @@ -43,24 +43,26 @@ struct vtkAnimateModesWorker scale = scale - 1.0; } - vtkSMPTools::For(0, numTuples, [&](vtkIdType start, vtkIdType end) { - bool isFirst = vtkSMPTools::GetSingleThread(); - for (vtkIdType cc = start; cc < end; ++cc) + vtkSMPTools::For(0, numTuples, + [&](vtkIdType start, vtkIdType end) { - if (isFirst) + bool isFirst = vtkSMPTools::GetSingleThread(); + for (vtkIdType cc = start; cc < end; ++cc) { - self->CheckAbort(); + if (isFirst) + { + self->CheckAbort(); + } + if (self->GetAbortOutput()) + { + break; + } + for (int comp = 0; comp < numComps; ++comp) + { + opts.Set(cc, comp, ipts.Get(cc, comp) + disp.Get(cc, comp) * scale); + } } - if (self->GetAbortOutput()) - { - break; - } - for (int comp = 0; comp < numComps; ++comp) - { - opts.Set(cc, comp, ipts.Get(cc, comp) + disp.Get(cc, comp) * scale); - } - } - }); + }); } }; @@ -151,7 +153,8 @@ int vtkAnimateModes::RequestData( : 0; // functor to animate block. - auto executeBlock = [this, modeShapeTime](vtkPointSet* block) { + auto executeBlock = [this, modeShapeTime](vtkPointSet* block) + { auto displacement = this->GetInputArrayToProcess(0, block); if (!displacement) { diff --git a/Filters/General/vtkCleanUnstructuredGrid.cxx b/Filters/General/vtkCleanUnstructuredGrid.cxx index 33bd7176dc9..be98b80ce26 100644 --- a/Filters/General/vtkCleanUnstructuredGrid.cxx +++ b/Filters/General/vtkCleanUnstructuredGrid.cxx @@ -216,7 +216,8 @@ struct SpatialDensityStrategy : public WeighingStrategy ds->GetCellPoints(0, pointIdList); } vtkSMPThreadLocalObject<vtkIdList> localPointIds; - auto distribute = [&](vtkIdType begin, vtkIdType end) { + auto distribute = [&](vtkIdType begin, vtkIdType end) + { for (vtkIdType iC = begin; iC < end; ++iC) { ds->GetCellPoints(iC, localPointIds.Local()); @@ -240,7 +241,8 @@ struct SpatialDensityStrategy : public WeighingStrategy // Normalize spatial densities with respect to point map { std::vector<double> masses(*std::max_element(ptMap.begin(), ptMap.end()) + 1, 0); - auto computeMasses = [&dRange, &masses, &ptMap](vtkIdType begin, vtkIdType end) { + auto computeMasses = [&dRange, &masses, &ptMap](vtkIdType begin, vtkIdType end) + { for (vtkIdType iP = begin; iP < end; ++iP) { if (ptMap[iP] < 0) @@ -255,8 +257,9 @@ struct SpatialDensityStrategy : public WeighingStrategy // Merits a dedicated struct with a reduce operation // collisions occurring in the += operation // vtkSMPTools::For(0, ds->GetNumberOfPoints(), computeMasses); - vtkSMPTools::For( - 0, ds->GetNumberOfPoints(), [&dRange, &masses, &ptMap](vtkIdType begin, vtkIdType end) { + vtkSMPTools::For(0, ds->GetNumberOfPoints(), + [&dRange, &masses, &ptMap](vtkIdType begin, vtkIdType end) + { for (vtkIdType iP = begin; iP < end; ++iP) { if (ptMap[iP] < 0) @@ -301,7 +304,8 @@ struct WeighingWorklet auto inRange = vtk::DataArrayTupleRange(inArray); auto outRange = vtk::DataArrayTupleRange(outArray); auto wRange = vtk::DataArrayValueRange<1>(weights); - auto weighing = [&](vtkIdType begin, vtkIdType end) { + auto weighing = [&](vtkIdType begin, vtkIdType end) + { for (vtkIdType iP = begin; iP < end; ++iP) { if (ptMap[iP] < 0) diff --git a/Filters/General/vtkClipDataSet.cxx b/Filters/General/vtkClipDataSet.cxx index ea6641e872f..4029c46e40b 100644 --- a/Filters/General/vtkClipDataSet.cxx +++ b/Filters/General/vtkClipDataSet.cxx @@ -392,7 +392,8 @@ int vtkClipDataSet::RequestData(vtkInformation* vtkNotUsed(request), } } - auto getCellType = [](vtkGenericCell* gCell, vtkIdType nPts, bool isSameCell) { + auto getCellType = [](vtkGenericCell* gCell, vtkIdType nPts, bool isSameCell) + { if (isSameCell) { return static_cast<VTKCellType>(gCell->GetCellType()); diff --git a/Filters/General/vtkContourTriangulator.cxx b/Filters/General/vtkContourTriangulator.cxx index f3f0d999397..0a4517ff824 100644 --- a/Filters/General/vtkContourTriangulator.cxx +++ b/Filters/General/vtkContourTriangulator.cxx @@ -2466,7 +2466,7 @@ int vtkCCSCutHoleyPolys(std::vector<vtkCCSPoly>& polys, vtkPoints* points, // If this is defined, then the outlines of any failed polygons will be // added to "data". It is only meant as a debugging tool. -//#define VTK_CCS_SHOW_FAILED_POLYS +// #define VTK_CCS_SHOW_FAILED_POLYS int vtkContourTriangulator::TriangulateContours(vtkPolyData* data, vtkIdType firstLine, vtkIdType numLines, vtkCellArray* polys, const double normal[3], vtkPolyDataAlgorithm* self) diff --git a/Filters/General/vtkDataSetGradientPrecompute.cxx b/Filters/General/vtkDataSetGradientPrecompute.cxx index a5d7ad908ef..a040916320d 100644 --- a/Filters/General/vtkDataSetGradientPrecompute.cxx +++ b/Filters/General/vtkDataSetGradientPrecompute.cxx @@ -22,7 +22,7 @@ #define VTK_DATASET_GRADIENT_TETRA_OPTIMIZATION #define VTK_DATASET_GRADIENT_TRIANGLE_OPTIMIZATION -//#define DEBUG +// #define DEBUG VTK_ABI_NAMESPACE_BEGIN vtkStandardNewMacro(vtkDataSetGradientPrecompute); diff --git a/Filters/General/vtkDeflectNormals.cxx b/Filters/General/vtkDeflectNormals.cxx index 96425c539e5..2af91611337 100644 --- a/Filters/General/vtkDeflectNormals.cxx +++ b/Filters/General/vtkDeflectNormals.cxx @@ -62,8 +62,9 @@ struct vtkDeflectNormalsWorker typedef vtkDataArrayAccessor<VectorArrayT> VectorAccessorT; VectorAccessorT vectors(vectorArray); const double* normal = this->Self->GetUserNormal(); - vtkSMPTools::For( - 0, vectorArray->GetNumberOfTuples(), [this, vectors, normal](vtkIdType begin, vtkIdType end) { + vtkSMPTools::For(0, vectorArray->GetNumberOfTuples(), + [this, vectors, normal](vtkIdType begin, vtkIdType end) + { bool isFirst = vtkSMPTools::GetSingleThread(); for (vtkIdType t = begin; t < end; ++t) { @@ -90,7 +91,8 @@ struct vtkDeflectNormalsWorker typedef vtkDataArrayAccessor<NormalArrayT> NormalAccessorT; NormalAccessorT normals(normalArray); vtkSMPTools::For(0, vectorArray->GetNumberOfTuples(), - [this, vectors, normals](vtkIdType begin, vtkIdType end) { + [this, vectors, normals](vtkIdType begin, vtkIdType end) + { bool isFirst = !vtkSMPTools::GetSingleThread(); for (vtkIdType t = begin; t < end; ++t) { diff --git a/Filters/General/vtkDistancePolyDataFilter.cxx b/Filters/General/vtkDistancePolyDataFilter.cxx index a45f602a8d0..64dde413685 100644 --- a/Filters/General/vtkDistancePolyDataFilter.cxx +++ b/Filters/General/vtkDistancePolyDataFilter.cxx @@ -99,34 +99,35 @@ void vtkDistancePolyDataFilter::GetPolyDataDistance(vtkPolyData* mesh, vtkPolyDa directionArray->SetNumberOfTuples(numPts); } - auto DistanceWithSign = [&](const double& val) { - return this->SignedDistance ? (this->NegateDistance ? -val : val) : std::abs(val); - }; + auto DistanceWithSign = [&](const double& val) + { return this->SignedDistance ? (this->NegateDistance ? -val : val) : std::abs(val); }; - vtkSMPTools::For(0, numPts, [&](vtkIdType begin, vtkIdType end) { - double pt[3]; - for (vtkIdType ptId = begin; ptId < end; ptId++) + vtkSMPTools::For(0, numPts, + [&](vtkIdType begin, vtkIdType end) { - mesh->GetPoint(ptId, pt); - if (this->ComputeDirection) + double pt[3]; + for (vtkIdType ptId = begin; ptId < end; ptId++) { - double closestPoint[3]; - double direction[3]; - double val = imp->EvaluateFunctionAndGetClosestPoint(pt, closestPoint); - double dist = DistanceWithSign(val); - vtkMath::Subtract(closestPoint, pt, direction); - vtkMath::Normalize(direction); - pointArray->SetValue(ptId, dist); - directionArray->SetTuple(ptId, direction); - } - else - { - double val = imp->EvaluateFunction(pt); - double dist = DistanceWithSign(val); - pointArray->SetValue(ptId, dist); + mesh->GetPoint(ptId, pt); + if (this->ComputeDirection) + { + double closestPoint[3]; + double direction[3]; + double val = imp->EvaluateFunctionAndGetClosestPoint(pt, closestPoint); + double dist = DistanceWithSign(val); + vtkMath::Subtract(closestPoint, pt, direction); + vtkMath::Normalize(direction); + pointArray->SetValue(ptId, dist); + directionArray->SetTuple(ptId, direction); + } + else + { + double val = imp->EvaluateFunction(pt); + double dist = DistanceWithSign(val); + pointArray->SetValue(ptId, dist); + } } - } - }); + }); mesh->GetPointData()->AddArray(pointArray); mesh->GetPointData()->SetActiveScalars("Distance"); @@ -155,34 +156,36 @@ void vtkDistancePolyDataFilter::GetPolyDataDistance(vtkPolyData* mesh, vtkPolyDa cellDirectionArray->SetNumberOfTuples(numCells); } vtkSMPThreadLocalObject<vtkGenericCell> TLCell; - vtkSMPTools::For(0, numCells, [&](vtkIdType begin, vtkIdType end) { - auto cell = TLCell.Local(); - int subId; - double pcoords[3], x[3], weights[VTK_MAXIMUM_NUMBER_OF_POINTS]; - for (vtkIdType cellId = begin; cellId < end; cellId++) + vtkSMPTools::For(0, numCells, + [&](vtkIdType begin, vtkIdType end) { - mesh->GetCell(cellId, cell); - cell->GetParametricCenter(pcoords); - cell->EvaluateLocation(subId, pcoords, x, weights); - if (this->ComputeDirection) + auto cell = TLCell.Local(); + int subId; + double pcoords[3], x[3], weights[VTK_MAXIMUM_NUMBER_OF_POINTS]; + for (vtkIdType cellId = begin; cellId < end; cellId++) { - double closestPoint[3]; - double direction[3]; - double val = imp->EvaluateFunctionAndGetClosestPoint(x, closestPoint); - double dist = DistanceWithSign(val); - vtkMath::Subtract(closestPoint, x, direction); - vtkMath::Normalize(direction); - cellArray->SetValue(cellId, dist); - cellDirectionArray->SetTuple(cellId, direction); + mesh->GetCell(cellId, cell); + cell->GetParametricCenter(pcoords); + cell->EvaluateLocation(subId, pcoords, x, weights); + if (this->ComputeDirection) + { + double closestPoint[3]; + double direction[3]; + double val = imp->EvaluateFunctionAndGetClosestPoint(x, closestPoint); + double dist = DistanceWithSign(val); + vtkMath::Subtract(closestPoint, x, direction); + vtkMath::Normalize(direction); + cellArray->SetValue(cellId, dist); + cellDirectionArray->SetTuple(cellId, direction); + } + else + { + double val = imp->EvaluateFunction(x); + double dist = DistanceWithSign(val); + cellArray->SetValue(cellId, dist); + } } - else - { - double val = imp->EvaluateFunction(x); - double dist = DistanceWithSign(val); - cellArray->SetValue(cellId, dist); - } - } - }); + }); mesh->GetCellData()->AddArray(cellArray); mesh->GetCellData()->SetActiveScalars("Distance"); diff --git a/Filters/General/vtkMergeTimeFilter.cxx b/Filters/General/vtkMergeTimeFilter.cxx index 4bb58b67f9d..01a46ecbbfd 100644 --- a/Filters/General/vtkMergeTimeFilter.cxx +++ b/Filters/General/vtkMergeTimeFilter.cxx @@ -89,9 +89,8 @@ void vtkMergeTimeFilter::MergeTimeSteps(const std::vector<double>& timeSteps) for (double newTime : timeSteps) { // lambda to find TimeStep in the list, depending on Tolerance. - auto insideTolerance = [this, newTime](double outputTime) { - return this->AreTimesWithinTolerance(outputTime, newTime); - }; + auto insideTolerance = [this, newTime](double outputTime) + { return this->AreTimesWithinTolerance(outputTime, newTime); }; auto it = std::find_if(this->OutputTimeSteps.begin(), this->OutputTimeSteps.end(), insideTolerance); diff --git a/Filters/General/vtkRemovePolyData.cxx b/Filters/General/vtkRemovePolyData.cxx index ac4209666a7..d6add68e154 100644 --- a/Filters/General/vtkRemovePolyData.cxx +++ b/Filters/General/vtkRemovePolyData.cxx @@ -237,12 +237,14 @@ struct MarkDeletedCells if (cellIdsPtr != nullptr) { vtkIdType numCellIds = cellIds->GetNumberOfTuples(); - vtkSMPTools::For(0, numCellIds, [&, cellIdsPtr, cellMap](vtkIdType idx, vtkIdType endIdx) { - for (; idx < endIdx; ++idx) + vtkSMPTools::For(0, numCellIds, + [&, cellIdsPtr, cellMap](vtkIdType idx, vtkIdType endIdx) { - (*cellMap)[cellIdsPtr[idx]] = (-1); - } - }); // end lambda + for (; idx < endIdx; ++idx) + { + (*cellMap)[cellIdsPtr[idx]] = (-1); + } + }); // end lambda } // Now process any additional polydata inputs, as well is point diff --git a/Filters/General/vtkSpatioTemporalHarmonicsAttribute.cxx b/Filters/General/vtkSpatioTemporalHarmonicsAttribute.cxx index e4a63ef157d..a2dfaeaf809 100644 --- a/Filters/General/vtkSpatioTemporalHarmonicsAttribute.cxx +++ b/Filters/General/vtkSpatioTemporalHarmonicsAttribute.cxx @@ -224,31 +224,33 @@ int vtkSpatioTemporalHarmonicsAttribute::RequestData( } else { - vtkSMPTools::For(0, nbPts, [&](vtkIdType begin, vtkIdType end) { - auto outputRange = vtk::DataArrayValueRange<1>(newScalars); - bool isFirst = vtkSMPTools::GetSingleThread(); - vtkIdType checkAbortInterval = std::min((end - begin) / 10 + 1, (vtkIdType)1000); - - for (vtkIdType pointId = begin; pointId < end; ++pointId) + vtkSMPTools::For(0, nbPts, + [&](vtkIdType begin, vtkIdType end) { - if (pointId % checkAbortInterval == 0) + auto outputRange = vtk::DataArrayValueRange<1>(newScalars); + bool isFirst = vtkSMPTools::GetSingleThread(); + vtkIdType checkAbortInterval = std::min((end - begin) / 10 + 1, (vtkIdType)1000); + + for (vtkIdType pointId = begin; pointId < end; ++pointId) { - if (isFirst) - { - this->CheckAbort(); - } - if (this->GetAbortOutput()) + if (pointId % checkAbortInterval == 0) { - break; + if (isFirst) + { + this->CheckAbort(); + } + if (this->GetAbortOutput()) + { + break; + } } - } - double coords[3]; - input->GetPoint(pointId, coords); + double coords[3]; + input->GetPoint(pointId, coords); - outputRange[pointId] = this->ComputeValue(coords, timeValue); - } - }); + outputRange[pointId] = this->ComputeValue(coords, timeValue); + } + }); } return 1; diff --git a/Filters/General/vtkTableBasedClipDataSet.cxx b/Filters/General/vtkTableBasedClipDataSet.cxx index 6e33bb8ba17..7a650b5473f 100644 --- a/Filters/General/vtkTableBasedClipDataSet.cxx +++ b/Filters/General/vtkTableBasedClipDataSet.cxx @@ -210,12 +210,14 @@ int vtkTableBasedClipDataSet::RequestData(vtkInformation* vtkNotUsed(request), else { scalars->SetNumberOfValues(numPoints); - vtkSMPTools::For(0, numPoints, [&](vtkIdType begin, vtkIdType end) { - for (vtkIdType i = begin; i < end; i++) + vtkSMPTools::For(0, numPoints, + [&](vtkIdType begin, vtkIdType end) { - scalars->SetValue(i, inputArray->GetComponent(i, 0)); - } - }); + for (vtkIdType i = begin; i < end; i++) + { + scalars->SetValue(i, inputArray->GetComponent(i, 0)); + } + }); } } @@ -453,7 +455,8 @@ struct EvaluatePoints // Prefix sum to create point map of kept (i.e., retained) points. auto pointsMap = vtk::DataArrayValueRange<1>(this->PointsMap); vtkSMPTools::For(0, this->PointBatches.GetNumberOfBatches(), - [&](vtkIdType beginBatchId, vtkIdType endBatchId) { + [&](vtkIdType beginBatchId, vtkIdType endBatchId) + { vtkIdType pointId; TInputIdType pointsMapValues[2] = { -1 /*always the same*/, 0 /*offset*/ }; bool isKept; @@ -758,8 +761,9 @@ struct EvaluateCells // merge thread local edges this->Edges.resize(totalSizeOfEdges); - vtkSMPTools::For( - 0, static_cast<vtkIdType>(tlEdgesVector.size()), [&](vtkIdType begin, vtkIdType end) { + vtkSMPTools::For(0, static_cast<vtkIdType>(tlEdgesVector.size()), + [&](vtkIdType begin, vtkIdType end) + { for (vtkIdType threadId = begin; threadId < end; ++threadId) { auto& edges = *tlEdgesVector[threadId]; @@ -1096,7 +1100,8 @@ struct ExtractPointsWorker const auto ptsMap = vtk::DataArrayValueRange<1>(pointsMap); // copy kept input points - auto extractKeptPoints = [&](vtkIdType beginBatchId, vtkIdType endBatchId) { + auto extractKeptPoints = [&](vtkIdType beginBatchId, vtkIdType endBatchId) + { vtkIdType pointId; double inputPoint[3]; @@ -1134,7 +1139,8 @@ struct ExtractPointsWorker vtkSMPTools::For(0, pointBatches.GetNumberOfBatches(), extractKeptPoints); // create edge points - auto extractEdgePoints = [&](vtkIdType beginEdgeId, vtkIdType endEdgeId) { + auto extractEdgePoints = [&](vtkIdType beginEdgeId, vtkIdType endEdgeId) + { vtkIdType outputEdgePointId; double edgePoint1[3], edgePoint2[3]; @@ -1173,7 +1179,8 @@ struct ExtractPointsWorker vtkSMPTools::For(0, numberOfEdges, extractEdgePoints); // create centroid points - auto extractCentroids = [&](vtkIdType beginCentroid, vtkIdType endCentroid) { + auto extractCentroids = [&](vtkIdType beginCentroid, vtkIdType endCentroid) + { vtkIdType outputCentroidPointId; double weights[MAX_CELL_SIZE]; double weightFactor; diff --git a/Filters/General/vtkTableFFT.cxx b/Filters/General/vtkTableFFT.cxx index ce83d6aa1e1..26951c50e45 100644 --- a/Filters/General/vtkTableFFT.cxx +++ b/Filters/General/vtkTableFFT.cxx @@ -64,20 +64,22 @@ struct vtkTableFFT::vtkInternal windowedSignal->SetNumberOfTuples(array->GetNumberOfTuples()); auto inputRange = vtk::DataArrayTupleRange(array); auto outRange = vtk::DataArrayTupleRange(windowedSignal); - vtkSMPTools::For(0, inputRange.size(), [&](vtkIdType begin, vtkIdType end) { - auto inputIt = inputRange.cbegin() + begin; - auto windowIt = this->Window.cbegin() + begin; - auto outputIt = outRange.begin() + begin; - for (vtkIdType i = begin; i < end; ++i, ++inputIt, ++windowIt, ++outputIt) + vtkSMPTools::For(0, inputRange.size(), + [&](vtkIdType begin, vtkIdType end) { - auto inComponentIt = inputIt->cbegin(); - auto outComponentIt = outputIt->begin(); - for (; inComponentIt != inputIt->cend(); ++inComponentIt, ++outComponentIt) + auto inputIt = inputRange.cbegin() + begin; + auto windowIt = this->Window.cbegin() + begin; + auto outputIt = outRange.begin() + begin; + for (vtkIdType i = begin; i < end; ++i, ++inputIt, ++windowIt, ++outputIt) { - *outComponentIt = *inComponentIt * *windowIt; + auto inComponentIt = inputIt->cbegin(); + auto outComponentIt = outputIt->begin(); + for (; inComponentIt != inputIt->cend(); ++inComponentIt, ++outComponentIt) + { + *outComponentIt = *inComponentIt * *windowIt; + } } - } - }); + }); vtkSmartPointer<vtkFFT::vtkScalarNumberArray> result = onesided ? vtkFFT::RFft(windowedSignal) : vtkFFT::Fft(windowedSignal); diff --git a/Filters/General/vtkTemporalPathLineFilter.cxx b/Filters/General/vtkTemporalPathLineFilter.cxx index 432bca949d4..deb1c76e559 100644 --- a/Filters/General/vtkTemporalPathLineFilter.cxx +++ b/Filters/General/vtkTemporalPathLineFilter.cxx @@ -447,7 +447,8 @@ void vtkTemporalPathLineFilter::AccumulateTrails(vtkDataSet* input, vtkDataSet* // * ids if there is no selection dataset // * IdChannelArray in the selection, or the global ids, or nullptr if there is a selection // dataset - vtkDataArray* selectionIds = [&selection, this] { + vtkDataArray* selectionIds = [&selection, this] + { if (!selection) { return (vtkDataArray*)(nullptr); @@ -480,9 +481,8 @@ void vtkTemporalPathLineFilter::AccumulateTrails(vtkDataSet* input, vtkDataSet* // This is a way to give limited friendness privileges to the worker without making them friends. // The worker is able to call processTrail without issues if you pass it as a parameter. - auto processTrail = [this](vtkDataSet* ds, vtkIdType pointId, vtkIdType gid) { - return this->IncrementTrail(this->GetTrail(gid), ds, pointId); - }; + auto processTrail = [this](vtkDataSet* ds, vtkIdType pointId, vtkIdType gid) + { return this->IncrementTrail(this->GetTrail(gid), ds, pointId); }; if (selectionIds && ids) { diff --git a/Filters/General/vtkWarpScalar.cxx b/Filters/General/vtkWarpScalar.cxx index c579383da3a..482858a4c89 100644 --- a/Filters/General/vtkWarpScalar.cxx +++ b/Filters/General/vtkWarpScalar.cxx @@ -120,43 +120,45 @@ struct ScaleWorker // We use THRESHOLD to test if the data size is small enough // to execute the functor serially. - vtkSMPTools::For(0, numPts, vtkSMPTools::THRESHOLD, [&](vtkIdType ptId, vtkIdType endPtId) { - double s, *n = normal, inNormal[3]; - bool isFirst = vtkSMPTools::GetSingleThread(); - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, numPts, vtkSMPTools::THRESHOLD, + [&](vtkIdType ptId, vtkIdType endPtId) { - if (isFirst) + double s, *n = normal, inNormal[3]; + bool isFirst = vtkSMPTools::GetSingleThread(); + for (; ptId < endPtId; ++ptId) { - self->CheckAbort(); - } - if (self->GetAbortOutput()) - { - break; - } - const auto xi = ipts[ptId]; - auto xo = opts[ptId]; + if (isFirst) + { + self->CheckAbort(); + } + if (self->GetAbortOutput()) + { + break; + } + const auto xi = ipts[ptId]; + auto xo = opts[ptId]; - if (XYPlane) - { - s = xi[2]; - } - else - { - const auto sval = sRange[ptId]; - s = sval[0]; // 0th component of the tuple - } + if (XYPlane) + { + s = xi[2]; + } + else + { + const auto sval = sRange[ptId]; + s = sval[0]; // 0th component of the tuple + } - if (inNormals) - { - inNormals->GetTuple(ptId, inNormal); - n = inNormal; - } + if (inNormals) + { + inNormals->GetTuple(ptId, inNormal); + n = inNormal; + } - xo[0] = xi[0] + sf * s * n[0]; - xo[1] = xi[1] + sf * s * n[1]; - xo[2] = xi[2] + sf * s * n[2]; - } - }); // lambda + xo[0] = xi[0] + sf * s * n[0]; + xo[1] = xi[1] + sf * s * n[1]; + xo[2] = xi[2] + sf * s * n[2]; + } + }); // lambda } }; diff --git a/Filters/General/vtkWarpVector.cxx b/Filters/General/vtkWarpVector.cxx index 569ab305a62..7f4e2bf2343 100644 --- a/Filters/General/vtkWarpVector.cxx +++ b/Filters/General/vtkWarpVector.cxx @@ -90,27 +90,29 @@ struct WarpWorker // We use THRESHOLD to test if the data size is small enough // to execute the functor serially. - vtkSMPTools::For(0, numPts, vtkSMPTools::THRESHOLD, [&](vtkIdType ptId, vtkIdType endPtId) { - bool isFirst = vtkSMPTools::GetSingleThread(); - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, numPts, vtkSMPTools::THRESHOLD, + [&](vtkIdType ptId, vtkIdType endPtId) { - if (isFirst) + bool isFirst = vtkSMPTools::GetSingleThread(); + for (; ptId < endPtId; ++ptId) { - self->CheckAbort(); + if (isFirst) + { + self->CheckAbort(); + } + if (self->GetAbortOutput()) + { + break; + } + const auto xi = ipts[ptId]; + auto xo = opts[ptId]; + const auto v = vecs[ptId]; + + xo[0] = xi[0] + sf * v[0]; + xo[1] = xi[1] + sf * v[1]; + xo[2] = xi[2] + sf * v[2]; } - if (self->GetAbortOutput()) - { - break; - } - const auto xi = ipts[ptId]; - auto xo = opts[ptId]; - const auto v = vecs[ptId]; - - xo[0] = xi[0] + sf * v[0]; - xo[1] = xi[1] + sf * v[1]; - xo[2] = xi[2] + sf * v[2]; - } - }); // lambda + }); // lambda } }; diff --git a/Filters/Generic/Testing/Cxx/TestGenericClip.cxx b/Filters/Generic/Testing/Cxx/TestGenericClip.cxx index 04c7831e323..97dd7d7431c 100644 --- a/Filters/Generic/Testing/Cxx/TestGenericClip.cxx +++ b/Filters/Generic/Testing/Cxx/TestGenericClip.cxx @@ -9,8 +9,8 @@ // not allow interaction and exit // -D <path> => path to the data; the data should be in <path>/Data/ -//#define WITH_GEOMETRY_FILTER -//#define WRITE_GENERIC_RESULT +// #define WITH_GEOMETRY_FILTER +// #define WRITE_GENERIC_RESULT #include "vtkActor.h" #include "vtkAttributesErrorMetric.h" diff --git a/Filters/Generic/Testing/Cxx/TestGenericDataSetTessellator.cxx b/Filters/Generic/Testing/Cxx/TestGenericDataSetTessellator.cxx index 6f9957db9cb..e152a5c1666 100644 --- a/Filters/Generic/Testing/Cxx/TestGenericDataSetTessellator.cxx +++ b/Filters/Generic/Testing/Cxx/TestGenericDataSetTessellator.cxx @@ -48,8 +48,8 @@ #endif // #ifdef WRITE_GENERIC_RESULT // debugging when clipping on n=(1,1,1) c=(0.5,0,0) -//#include "vtkExtractGeometry.h" -//#include "vtkSphere.h" +// #include "vtkExtractGeometry.h" +// #include "vtkSphere.h" // Remark about the lookup tables that seem different between the // GenericGeometryFilter and GenericDataSetTessellator: diff --git a/Filters/Generic/Testing/Cxx/TestGenericGeometryFilter.cxx b/Filters/Generic/Testing/Cxx/TestGenericGeometryFilter.cxx index a4a7c0bdda6..7c10e04400c 100644 --- a/Filters/Generic/Testing/Cxx/TestGenericGeometryFilter.cxx +++ b/Filters/Generic/Testing/Cxx/TestGenericGeometryFilter.cxx @@ -9,7 +9,7 @@ // not allow interaction and exit // -D <path> => path to the data; the data should be in <path>/Data/ -//#define WRITE_GENERIC_RESULT +// #define WRITE_GENERIC_RESULT #include "vtkActor.h" #include "vtkAttributesErrorMetric.h" diff --git a/Filters/Generic/Testing/Cxx/TestGenericProbeFilter.cxx b/Filters/Generic/Testing/Cxx/TestGenericProbeFilter.cxx index b0b37bb1ddc..102252a36c1 100644 --- a/Filters/Generic/Testing/Cxx/TestGenericProbeFilter.cxx +++ b/Filters/Generic/Testing/Cxx/TestGenericProbeFilter.cxx @@ -8,8 +8,8 @@ // not allow interaction and exit // -D <path> => path to the data; the data should be in <path>/Data/ -//#define ADD_GEOMETRY -//#define STD_PROBE +// #define ADD_GEOMETRY +// #define STD_PROBE #include "vtkActor.h" #include "vtkAttributesErrorMetric.h" diff --git a/Filters/Generic/Testing/Cxx/TestGenericStreamTracer.cxx b/Filters/Generic/Testing/Cxx/TestGenericStreamTracer.cxx index ac65786911f..06fbdf170b3 100644 --- a/Filters/Generic/Testing/Cxx/TestGenericStreamTracer.cxx +++ b/Filters/Generic/Testing/Cxx/TestGenericStreamTracer.cxx @@ -9,7 +9,7 @@ // not allow interaction and exit // -D <path> => path to the data; the data should be in <path>/Data/ -//#define WRITE_GENERIC_RESULT +// #define WRITE_GENERIC_RESULT #include "vtkActor.h" #include "vtkAssignAttribute.h" diff --git a/Filters/Geometry/Testing/Cxx/TestStructuredAMRGridConnectivity.cxx b/Filters/Geometry/Testing/Cxx/TestStructuredAMRGridConnectivity.cxx index 2559a2e5c34..a6d26d97c8f 100644 --- a/Filters/Geometry/Testing/Cxx/TestStructuredAMRGridConnectivity.cxx +++ b/Filters/Geometry/Testing/Cxx/TestStructuredAMRGridConnectivity.cxx @@ -28,7 +28,7 @@ #include <string> #include <vector> -//#define ENABLE_IO +// #define ENABLE_IO #define IMIN(ext) ext[0] #define IMAX(ext) ext[1] diff --git a/Filters/Geometry/Testing/Cxx/TestStructuredGridConnectivity.cxx b/Filters/Geometry/Testing/Cxx/TestStructuredGridConnectivity.cxx index 388b1b20fbf..e63886724d8 100644 --- a/Filters/Geometry/Testing/Cxx/TestStructuredGridConnectivity.cxx +++ b/Filters/Geometry/Testing/Cxx/TestStructuredGridConnectivity.cxx @@ -35,7 +35,7 @@ #include <string> #include <vector> -//#define ENABLE_IO +// #define ENABLE_IO namespace { diff --git a/Filters/Geometry/Testing/Cxx/TestUnstructuredGridGeometryFilter.cxx b/Filters/Geometry/Testing/Cxx/TestUnstructuredGridGeometryFilter.cxx index fe58a6324b0..8f27f224a10 100644 --- a/Filters/Geometry/Testing/Cxx/TestUnstructuredGridGeometryFilter.cxx +++ b/Filters/Geometry/Testing/Cxx/TestUnstructuredGridGeometryFilter.cxx @@ -9,17 +9,17 @@ // If READ_FILE is defined, the unstructured grid is read from a file otherwise // it is created cell by cell. -//#define READ_FILE +// #define READ_FILE // If WRITE_RESULT is defined, the result of the surface filter is saved. -//#define WRITE_RESULT +// #define WRITE_RESULT // If USE_SHRINK is defined, each face is shrink to easily detect bad faces. #define USE_SHRINK // If FAST_GEOMETRY is defined, a vtkDataSetSurfaceFilter is used instead // of a vtkGeometryFilter at the end of the pipeline -//#define FAST_GEOMETRY +// #define FAST_GEOMETRY // If USE_CULLING is defined, backface culling is used to detect any bad // ordering of points defining a face. diff --git a/Filters/Geometry/vtkAttributeSmoothingFilter.cxx b/Filters/Geometry/vtkAttributeSmoothingFilter.cxx index 9c8db3b6328..333bd9dbabf 100644 --- a/Filters/Geometry/vtkAttributeSmoothingFilter.cxx +++ b/Filters/Geometry/vtkAttributeSmoothingFilter.cxx @@ -383,15 +383,17 @@ void MarkDSBoundary(vtkDataSet* ds, unsigned char* smooth) unsigned char* ptr = ptMarks->GetPointer(0); // Now copy the information over (with in-place lambda). - vtkSMPTools::For(0, ds->GetNumberOfPoints(), [&ptr, &smooth](vtkIdType ptId, vtkIdType endPtId) { - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, ds->GetNumberOfPoints(), + [&ptr, &smooth](vtkIdType ptId, vtkIdType endPtId) { - if (ptr[ptId] != 0) + for (; ptId < endPtId; ++ptId) { - smooth[ptId] = Boundary; + if (ptr[ptId] != 0) + { + smooth[ptId] = Boundary; + } } - } - }); + }); } // MarkDSBoundary // Mark all points directly adjacent to the dataset boundary (i.e., diff --git a/Filters/Geometry/vtkDataSetSurfaceFilter.cxx b/Filters/Geometry/vtkDataSetSurfaceFilter.cxx index c587b18dfc5..5538140864e 100644 --- a/Filters/Geometry/vtkDataSetSurfaceFilter.cxx +++ b/Filters/Geometry/vtkDataSetSurfaceFilter.cxx @@ -108,7 +108,8 @@ bool StructuredExecuteWithBlanking( // Extracts a either the min (or max) face along the `axis` for the cell // identified by `cellId` in the input dataset. - auto getFace = [&inExtent](const int ijk[3], const int axis, bool minFace) { + auto getFace = [&inExtent](const int ijk[3], const int axis, bool minFace) + { const int iAxis = (axis + 1) % 3; const int jAxis = (axis + 2) % 3; @@ -142,7 +143,8 @@ bool StructuredExecuteWithBlanking( // Passes data arrays. Also adds `originalIds` the output if `arrayName` // non-null. auto passData = [](vtkIdTypeArray* originalIds, vtkDataSetAttributes* inputDSA, - vtkDataSetAttributes* outputDSA, const char* arrayName) { + vtkDataSetAttributes* outputDSA, const char* arrayName) + { const auto numValues = originalIds->GetNumberOfTuples(); outputDSA->CopyGlobalIdsOn(); outputDSA->CopyFieldOff(vtkDataSetAttributes::GhostArrayName()); @@ -181,7 +183,8 @@ bool StructuredExecuteWithBlanking( vtkNew<vtkIdTypeArray> originalCellIds; originalCellIds->Allocate(input->GetNumberOfCells()); - auto addFaceToOutput = [&](const std::array<vtkIdType, 4>& ptIds, vtkIdType inCellId) { + auto addFaceToOutput = [&](const std::array<vtkIdType, 4>& ptIds, vtkIdType inCellId) + { vtkIdType outPtIds[5]; for (int cc = 0; cc < 4; ++cc) { @@ -2057,7 +2060,8 @@ int vtkDataSetSurfaceFilter::UnstructuredGridExecuteInternal( } bool isDegenerateCell = false; - auto isDegeneratedSubTriangle = [&](vtkIdType ii) { + auto isDegeneratedSubTriangle = [&](vtkIdType ii) + { return outPts->GetId(pts->GetId(ii)) == outPts->GetId(pts->GetId(ii + 1)) || outPts->GetId(pts->GetId(ii)) == outPts->GetId(pts->GetId(ii + 2)) || outPts->GetId(pts->GetId(ii + 1)) == outPts->GetId(pts->GetId(ii + 2)); @@ -2085,9 +2089,8 @@ int vtkDataSetSurfaceFilter::UnstructuredGridExecuteInternal( // localEdgeMap is simular to this->EdgeMap, but only stores local ids localEdgeMap->clear(); - auto isEqualTo1Or0 = [](double a, double e = 1e-10) { - return (std::abs(a) <= e) || (std::abs(a - 1) <= e); - }; + auto isEqualTo1Or0 = [](double a, double e = 1e-10) + { return (std::abs(a) <= e) || (std::abs(a - 1) <= e); }; vtkIdType localIdCpt = numFacePts; vtkIdType pt1, pt2, id; diff --git a/Filters/Geometry/vtkGeometryFilter.cxx b/Filters/Geometry/vtkGeometryFilter.cxx index 9b0e4f912b8..5f50643402d 100644 --- a/Filters/Geometry/vtkGeometryFilter.cxx +++ b/Filters/Geometry/vtkGeometryFilter.cxx @@ -2463,12 +2463,14 @@ int ExecutePolyData(vtkGeometryFilter* self, vtkDataSet* dataSetInput, vtkPolyDa { origPointIds.SetNumberOfValues(numPts); vtkIdType* origPointIdsPtr = origPointIds.GetPointer(); - vtkSMPTools::For(0, numPts, [&origPointIdsPtr](vtkIdType pId, vtkIdType endPId) { - for (; pId < endPId; ++pId) + vtkSMPTools::For(0, numPts, + [&origPointIdsPtr](vtkIdType pId, vtkIdType endPId) { - origPointIdsPtr[pId] = pId; - } - }); + for (; pId < endPId; ++pId) + { + origPointIdsPtr[pId] = pId; + } + }); } // Special case when data is just passed through @@ -2482,12 +2484,14 @@ int ExecutePolyData(vtkGeometryFilter* self, vtkDataSet* dataSetInput, vtkPolyDa { origCellIds.SetNumberOfValues(numCells); vtkIdType* origCellIdsPtr = origCellIds.GetPointer(); - vtkSMPTools::For(0, numCells, [&origCellIdsPtr](vtkIdType cId, vtkIdType endCId) { - for (; cId < endCId; ++cId) + vtkSMPTools::For(0, numCells, + [&origCellIdsPtr](vtkIdType cId, vtkIdType endCId) { - origCellIdsPtr[cId] = cId; - } - }); + for (; cId < endCId; ++cId) + { + origCellIdsPtr[cId] = cId; + } + }); } return 1; @@ -2750,15 +2754,17 @@ void PassPointIds(const char* name, vtkIdType numInputPts, vtkIdType numOutputPt vtkIdType* origIds = origPtIds->GetPointer(0); // Now threaded populate the array - vtkSMPTools::For(0, numInputPts, [&origIds, &ptMap](vtkIdType ptId, vtkIdType endPtId) { - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, numInputPts, + [&origIds, &ptMap](vtkIdType ptId, vtkIdType endPtId) { - if (ptMap[ptId] >= 0) + for (; ptId < endPtId; ++ptId) { - origIds[ptMap[ptId]] = ptId; + if (ptMap[ptId] >= 0) + { + origIds[ptMap[ptId]] = ptId; + } } - } - }); + }); } //------------------------------------------------------------------------------ diff --git a/Filters/Geometry/vtkRecoverGeometryWireframe.cxx b/Filters/Geometry/vtkRecoverGeometryWireframe.cxx index f1984bd6dda..32d9b71d47a 100644 --- a/Filters/Geometry/vtkRecoverGeometryWireframe.cxx +++ b/Filters/Geometry/vtkRecoverGeometryWireframe.cxx @@ -179,7 +179,8 @@ int vtkRecoverGeometryWireframe::RequestData(vtkInformation* vtkNotUsed(request) outputPD->AddArray(edgeflags); outputPD->SetActiveAttribute("vtkEdgeFlags", vtkDataSetAttributes::EDGEFLAG); - auto tagEdgeFlags = [&edgeflags](vtkCellArray* inputCell, vtkIdType offset = 0) { + auto tagEdgeFlags = [&edgeflags](vtkCellArray* inputCell, vtkIdType offset = 0) + { auto cellIter = vtk::TakeSmartPointer(inputCell->NewIterator()); vtkIdType npts; const vtkIdType* pts; diff --git a/Filters/Geometry/vtkUnstructuredGridGeometryFilter.cxx b/Filters/Geometry/vtkUnstructuredGridGeometryFilter.cxx index 8f09d5dc806..a0187bd32f8 100644 --- a/Filters/Geometry/vtkUnstructuredGridGeometryFilter.cxx +++ b/Filters/Geometry/vtkUnstructuredGridGeometryFilter.cxx @@ -1202,14 +1202,14 @@ int vtkUnstructuredGridGeometryFilter::RequestData(vtkInformation* vtkNotUsed(re input->GetCellData(), npts, cellId, order); vtkIdType nPoints = 0; std::vector<vtkIdType> points; - const auto set_number_of_ids_and_points = [&](const vtkIdType& numFacePoints) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& numFacePoints) -> void + { points.resize(numFacePoints); nPoints = numFacePoints; }; const auto set_ids_and_points = [&](const vtkIdType& face_id, - const vtkIdType& vol_id) -> void { - points[face_id] = pts[vol_id]; - }; + const vtkIdType& vol_id) -> void + { points[face_id] = pts[vol_id]; }; int faceCellType = (cellType == VTK_LAGRANGE_HEXAHEDRON) ? VTK_LAGRANGE_QUADRILATERAL : VTK_BEZIER_QUADRILATERAL; @@ -1229,14 +1229,14 @@ int vtkUnstructuredGridGeometryFilter::RequestData(vtkInformation* vtkNotUsed(re int faceOrder[2] = { 0, 0 }; vtkIdType nPoints = 0; std::vector<vtkIdType> points; - const auto set_number_of_ids_and_points = [&](const vtkIdType& numFacePoints) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& numFacePoints) -> void + { points.resize(numFacePoints); nPoints = numFacePoints; }; const auto set_ids_and_points = [&](const vtkIdType& face_id, - const vtkIdType& vol_id) -> void { - points[face_id] = pts[vol_id]; - }; + const vtkIdType& vol_id) -> void + { points[face_id] = pts[vol_id]; }; int faceCellType = (cellType == VTK_LAGRANGE_TETRAHEDRON) ? VTK_LAGRANGE_TRIANGLE : VTK_BEZIER_TRIANGLE; @@ -1257,14 +1257,14 @@ int vtkUnstructuredGridGeometryFilter::RequestData(vtkInformation* vtkNotUsed(re vtkHigherOrderWedge::SetOrderFromCellData(input->GetCellData(), npts, cellId, order); vtkIdType nPoints = 0; std::vector<vtkIdType> points; - const auto set_number_of_ids_and_points = [&](const vtkIdType& numFacePoints) -> void { + const auto set_number_of_ids_and_points = [&](const vtkIdType& numFacePoints) -> void + { points.resize(numFacePoints); nPoints = numFacePoints; }; const auto set_ids_and_points = [&](const vtkIdType& face_id, - const vtkIdType& vol_id) -> void { - points[face_id] = pts[vol_id]; - }; + const vtkIdType& vol_id) -> void + { points[face_id] = pts[vol_id]; }; int faceCellType = (cellType == VTK_LAGRANGE_WEDGE) ? VTK_LAGRANGE_TRIANGLE : VTK_BEZIER_TRIANGLE; diff --git a/Filters/GeometryPreview/vtkOctreeImageToPointSetFilter.cxx b/Filters/GeometryPreview/vtkOctreeImageToPointSetFilter.cxx index a87da79818c..086ede37839 100644 --- a/Filters/GeometryPreview/vtkOctreeImageToPointSetFilter.cxx +++ b/Filters/GeometryPreview/vtkOctreeImageToPointSetFilter.cxx @@ -354,22 +354,26 @@ int vtkOctreeImageToPointSetFilter::RequestData( { vtkNew<vtkIdTypeArray> connectivity; connectivity->SetNumberOfValues(numberOfOutputPoints); - vtkSMPTools::For(0, numberOfOutputPoints, [&](vtkIdType begin, vtkIdType end) { - auto connectivityPtr = connectivity->GetPointer(0); - for (vtkIdType i = begin; i < end; ++i) + vtkSMPTools::For(0, numberOfOutputPoints, + [&](vtkIdType begin, vtkIdType end) { - connectivityPtr[i] = i; - } - }); + auto connectivityPtr = connectivity->GetPointer(0); + for (vtkIdType i = begin; i < end; ++i) + { + connectivityPtr[i] = i; + } + }); vtkNew<vtkIdTypeArray> offsets; offsets->SetNumberOfValues(numberOfOutputPoints + 1); - vtkSMPTools::For(0, numberOfOutputPoints + 1, [&](vtkIdType begin, vtkIdType end) { - auto offsetsPtr = offsets->GetPointer(0); - for (vtkIdType i = begin; i < end; ++i) + vtkSMPTools::For(0, numberOfOutputPoints + 1, + [&](vtkIdType begin, vtkIdType end) { - offsetsPtr[i] = i; - } - }); + auto offsetsPtr = offsets->GetPointer(0); + for (vtkIdType i = begin; i < end; ++i) + { + offsetsPtr[i] = i; + } + }); vtkNew<vtkCellArray> cells; cells->SetData(offsets, connectivity); output->SetVerts(cells); diff --git a/Filters/GeometryPreview/vtkPointSetToOctreeImageFilter.cxx b/Filters/GeometryPreview/vtkPointSetToOctreeImageFilter.cxx index 4f9b7d45242..275693ca991 100644 --- a/Filters/GeometryPreview/vtkPointSetToOctreeImageFilter.cxx +++ b/Filters/GeometryPreview/vtkPointSetToOctreeImageFilter.cxx @@ -199,20 +199,22 @@ struct vtkPointSetToOctreeImageFilter::PointSetToImageFunctor // Compute mean if (this->UseFieldArray && this->Functions.back() == FieldFunctions::MEAN) { - vtkSMPTools::For(0, this->OutField->GetNumberOfTuples(), [&](vtkIdType begin, vtkIdType end) { - auto outField = vtk::DataArrayTupleRange(this->OutField, begin, end); - const int numFunctions = static_cast<int>(this->Functions.size()); - const int meanIndex = numFunctions - 1; - const int sumIndex = numFunctions - 2; - const int countIndex = numFunctions - 3; - for (auto tuple : outField) + vtkSMPTools::For(0, this->OutField->GetNumberOfTuples(), + [&](vtkIdType begin, vtkIdType end) { - if (tuple[countIndex] != 0.0f) + auto outField = vtk::DataArrayTupleRange(this->OutField, begin, end); + const int numFunctions = static_cast<int>(this->Functions.size()); + const int meanIndex = numFunctions - 1; + const int sumIndex = numFunctions - 2; + const int countIndex = numFunctions - 3; + for (auto tuple : outField) { - tuple[meanIndex] = static_cast<float>(tuple[sumIndex]) / tuple[countIndex]; + if (tuple[countIndex] != 0.0f) + { + tuple[meanIndex] = static_cast<float>(tuple[sumIndex]) / tuple[countIndex]; + } } - } - }); + }); } } }; @@ -372,13 +374,15 @@ int vtkPointSetToOctreeImageFilter::RequestData( break; } } - vtkSMPTools::For(0, numberOfCells, [&](vtkIdType begin, vtkIdType end) { - auto outFieldRange = vtk::DataArrayTupleRange(outField, begin, end); - for (auto outTuple : outFieldRange) + vtkSMPTools::For(0, numberOfCells, + [&](vtkIdType begin, vtkIdType end) { - std::copy(defaultValues.begin(), defaultValues.end(), outTuple.begin()); - } - }); + auto outFieldRange = vtk::DataArrayTupleRange(outField, begin, end); + for (auto outTuple : outFieldRange) + { + std::copy(defaultValues.begin(), defaultValues.end(), outTuple.begin()); + } + }); } // define output image diff --git a/Filters/Hybrid/Testing/Cxx/TestTemporalCacheMemkind.cxx b/Filters/Hybrid/Testing/Cxx/TestTemporalCacheMemkind.cxx index 3d7d443bffa..957b40fd4c7 100644 --- a/Filters/Hybrid/Testing/Cxx/TestTemporalCacheMemkind.cxx +++ b/Filters/Hybrid/Testing/Cxx/TestTemporalCacheMemkind.cxx @@ -106,9 +106,8 @@ int vtkTemporalSphereSource2::RequestData( double requestedTimeValue = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()); this->ActualTimeStep = std::find_if(this->TimeStepValues.begin(), this->TimeStepValues.end(), - [requestedTimeValue](double const& v) { - return vtkTestTemporalCacheSimpleWithinTolerance2(v, requestedTimeValue); - }) - + [requestedTimeValue](double const& v) + { return vtkTestTemporalCacheSimpleWithinTolerance2(v, requestedTimeValue); }) - this->TimeStepValues.begin(); this->ActualTimeStep = this->ActualTimeStep + this->TimeStepRange[0]; } diff --git a/Filters/Hybrid/Testing/Cxx/TestTemporalCacheSimple.cxx b/Filters/Hybrid/Testing/Cxx/TestTemporalCacheSimple.cxx index a333c3129f6..af437cd47a3 100644 --- a/Filters/Hybrid/Testing/Cxx/TestTemporalCacheSimple.cxx +++ b/Filters/Hybrid/Testing/Cxx/TestTemporalCacheSimple.cxx @@ -123,9 +123,8 @@ int vtkTemporalSphereSource::RequestData( double requestedTimeValue = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()); this->ActualTimeStep = std::find_if(this->TimeStepValues.begin(), this->TimeStepValues.end(), - [requestedTimeValue](double const& v) { - return vtkTestTemporalCacheSimpleWithinTolerance(v, requestedTimeValue); - }) - + [requestedTimeValue](double const& v) + { return vtkTestTemporalCacheSimpleWithinTolerance(v, requestedTimeValue); }) - this->TimeStepValues.begin(); this->ActualTimeStep = this->ActualTimeStep + this->TimeStepRange[0]; } diff --git a/Filters/Hybrid/vtkPCAAnalysisFilter.cxx b/Filters/Hybrid/vtkPCAAnalysisFilter.cxx index c931079effa..10b88a406ac 100644 --- a/Filters/Hybrid/vtkPCAAnalysisFilter.cxx +++ b/Filters/Hybrid/vtkPCAAnalysisFilter.cxx @@ -30,7 +30,7 @@ static inline double** NewMatrix(int rows, int cols) //------------------------------------------------------------------------------ static inline void DeleteMatrix(double** m) { - delete[] * m; + delete[] *m; delete[] m; } diff --git a/Filters/HyperTree/Testing/Cxx/TestHyperTreeGridTernarySphereMaterialReflections.cxx b/Filters/HyperTree/Testing/Cxx/TestHyperTreeGridTernarySphereMaterialReflections.cxx index 6550ee5c145..5005a772bf9 100644 --- a/Filters/HyperTree/Testing/Cxx/TestHyperTreeGridTernarySphereMaterialReflections.cxx +++ b/Filters/HyperTree/Testing/Cxx/TestHyperTreeGridTernarySphereMaterialReflections.cxx @@ -22,7 +22,7 @@ #include "vtkRenderer.h" #include "vtkTimerLog.h" -//#define HYPERTREEGRID_GETRUSAGE +// #define HYPERTREEGRID_GETRUSAGE #ifdef HYPERTREEGRID_GETRUSAGE #include <sys/resource.h> #endif diff --git a/Filters/HyperTree/vtkHyperTreeGridEvaluateCoarse.cxx b/Filters/HyperTree/vtkHyperTreeGridEvaluateCoarse.cxx index 5b162a09d54..58838fb3717 100644 --- a/Filters/HyperTree/vtkHyperTreeGridEvaluateCoarse.cxx +++ b/Filters/HyperTree/vtkHyperTreeGridEvaluateCoarse.cxx @@ -149,7 +149,8 @@ void vtkHyperTreeGridEvaluateCoarse::ProcessNode(vtkHyperTreeGridNonOrientedCurs { // Create a new thread for every child, when we're not too deep into the tree vtkThreadedTaskQueue<void, int> queue( - [this, outCursor, &childrenValues](int ichild) { + [this, outCursor, &childrenValues](int ichild) + { vtkSmartPointer<vtkHyperTreeGridNonOrientedCursor> childCursor = vtk::TakeSmartPointer(outCursor->CloneFromCurrentEntry()); this->ProcessChild(childCursor, ichild, childrenValues[ichild]); diff --git a/Filters/HyperTree/vtkHyperTreeGridFeatureEdges.cxx b/Filters/HyperTree/vtkHyperTreeGridFeatureEdges.cxx index 83f36b24f19..767196e37e5 100644 --- a/Filters/HyperTree/vtkHyperTreeGridFeatureEdges.cxx +++ b/Filters/HyperTree/vtkHyperTreeGridFeatureEdges.cxx @@ -260,9 +260,8 @@ void vtkHyperTreeGridFeatureEdges::RecursivelyProcess3DHTGTree(vtkHyperTreeGrid* bool vtkHyperTreeGridFeatureEdges::ShouldAddEdge2D( vtkHyperTreeGridNonOrientedVonNeumannSuperCursor* cursor, unsigned int edgeId) { - auto neighborVisible = [&cursor](unsigned int neighborId) { - return cursor->HasTree(neighborId) && !cursor->IsMasked(neighborId); - }; + auto neighborVisible = [&cursor](unsigned int neighborId) + { return cursor->HasTree(neighborId) && !cursor->IsMasked(neighborId); }; const unsigned int neighborId = VON_NEUMANN_NEIGH_ID_2D[edgeId]; @@ -278,17 +277,14 @@ bool vtkHyperTreeGridFeatureEdges::ShouldAddEdge2D( bool vtkHyperTreeGridFeatureEdges::ShouldAddEdge3D( vtkHyperTreeGridNonOrientedMooreSuperCursor* cursor, unsigned int edgeId) { - auto neighborVisible = [&cursor](unsigned int neighborId) { - return cursor->HasTree(neighborId) && !cursor->IsMasked(neighborId); - }; + auto neighborVisible = [&cursor](unsigned int neighborId) + { return cursor->HasTree(neighborId) && !cursor->IsMasked(neighborId); }; - auto neighborVisibleAndInf = [&cursor, &neighborVisible](unsigned int neighborId) { - return neighborVisible(neighborId) && cursor->GetLevel(neighborId) < cursor->GetLevel(); - }; + auto neighborVisibleAndInf = [&cursor, &neighborVisible](unsigned int neighborId) + { return neighborVisible(neighborId) && cursor->GetLevel(neighborId) < cursor->GetLevel(); }; - auto neighborVisibleAndLeaf = [&cursor, &neighborVisible](unsigned int neighborId) { - return neighborVisible(neighborId) && cursor->IsLeaf(neighborId); - }; + auto neighborVisibleAndLeaf = [&cursor, &neighborVisible](unsigned int neighborId) + { return neighborVisible(neighborId) && cursor->IsLeaf(neighborId); }; const unsigned int* neighborIds = MOORE_NEIGH_IDS_3D[edgeId]; diff --git a/Filters/HyperTree/vtkHyperTreeGridGeometry3DImpl.cxx b/Filters/HyperTree/vtkHyperTreeGridGeometry3DImpl.cxx index 590329ae583..d955f2e03ea 100644 --- a/Filters/HyperTree/vtkHyperTreeGridGeometry3DImpl.cxx +++ b/Filters/HyperTree/vtkHyperTreeGridGeometry3DImpl.cxx @@ -252,44 +252,45 @@ void vtkHyperTreeGridGeometry3DImpl::GenerateCellSurface( } auto createInterfacePoints = - [&](std::map<unsigned int, std::pair<HTG3DPoint*, unsigned int>>& interface) { - if (!interface.empty() && interface.size() >= 3) + [&](std::map<unsigned int, std::pair<HTG3DPoint*, unsigned int>>& interface) + { + if (!interface.empty() && interface.size() >= 3) + { + std::vector<vtkIdType> newOutputPointIds; + unsigned int firstEdge = interface.begin()->first; + if (firstEdge == VTK_DEFAULT_EDGE_INDEX) { - std::vector<vtkIdType> newOutputPointIds; - unsigned int firstEdge = interface.begin()->first; - if (firstEdge == VTK_DEFAULT_EDGE_INDEX) - { - vtkWarningWithObjectMacro(nullptr, "Uninitialized edge encountered"); - return; - } - else + vtkWarningWithObjectMacro(nullptr, "Uninitialized edge encountered"); + return; + } + else + { + HTG3DPoint* pt = interface[firstEdge].first; + newOutputPointIds.emplace_back(pt->Id); + unsigned int next = interface[firstEdge].second; + while (next != firstEdge && next != VTK_DEFAULT_EDGE_INDEX) { - HTG3DPoint* pt = interface[firstEdge].first; + // XXX: think adding an "emergency" breaking condition to + // avoid potential infinite looping + pt = interface[next].first; newOutputPointIds.emplace_back(pt->Id); - unsigned int next = interface[firstEdge].second; - while (next != firstEdge && next != VTK_DEFAULT_EDGE_INDEX) - { - // XXX: think adding an "emergency" breaking condition to - // avoid potential infinite looping - pt = interface[next].first; - newOutputPointIds.emplace_back(pt->Id); - next = interface[next].second; - } - if (next == VTK_DEFAULT_EDGE_INDEX) - { - vtkWarningWithObjectMacro(nullptr, "Uninitialized edge encountered"); - return; - } + next = interface[next].second; } - - // XXX: We need to clarify a criterion for valid cells - // (i.e. that can be added to the output) - if (!newOutputPointIds.empty()) + if (next == VTK_DEFAULT_EDGE_INDEX) { - this->CreateNewCellAndCopyData(newOutputPointIds, cellId); + vtkWarningWithObjectMacro(nullptr, "Uninitialized edge encountered"); + return; } } - }; + + // XXX: We need to clarify a criterion for valid cells + // (i.e. that can be added to the output) + if (!newOutputPointIds.empty()) + { + this->CreateNewCellAndCopyData(newOutputPointIds, cellId); + } + } + }; // Create interface points for interface A and B if they are defined createInterfacePoints(internalFaceA); diff --git a/Filters/HyperTree/vtkHyperTreeGridThreshold.cxx b/Filters/HyperTree/vtkHyperTreeGridThreshold.cxx index dddb05a204d..c37a27ad110 100644 --- a/Filters/HyperTree/vtkHyperTreeGridThreshold.cxx +++ b/Filters/HyperTree/vtkHyperTreeGridThreshold.cxx @@ -484,7 +484,8 @@ bool vtkHyperTreeGridThreshold::RecursivelyProcessTreeWithCreateNewMask( { // Create a new thread for every child, when we're not too deep into the tree vtkThreadedTaskQueue<bool, int> queue( - [this, outCursor](int ichild) { + [this, outCursor](int ichild) + { vtkSmartPointer<vtkHyperTreeGridNonOrientedCursor> childOutCursor = vtk::TakeSmartPointer(outCursor->CloneFromCurrentEntry()); diff --git a/Filters/Modeling/Testing/Cxx/TestPolyDataPointSampler.cxx b/Filters/Modeling/Testing/Cxx/TestPolyDataPointSampler.cxx index fe0b50914fa..197cc614122 100644 --- a/Filters/Modeling/Testing/Cxx/TestPolyDataPointSampler.cxx +++ b/Filters/Modeling/Testing/Cxx/TestPolyDataPointSampler.cxx @@ -6,7 +6,7 @@ // -D <path> => path to the data; the data should be in <path>/Data/ // If WRITE_RESULT is defined, the result of the surface filter is saved. -//#define WRITE_RESULT +// #define WRITE_RESULT #include "vtkActor.h" #include "vtkCamera.h" diff --git a/Filters/Modeling/Testing/Cxx/TestSelectEnclosedPoints.cxx b/Filters/Modeling/Testing/Cxx/TestSelectEnclosedPoints.cxx index 8a960d5e2f4..0bb97edd170 100644 --- a/Filters/Modeling/Testing/Cxx/TestSelectEnclosedPoints.cxx +++ b/Filters/Modeling/Testing/Cxx/TestSelectEnclosedPoints.cxx @@ -8,7 +8,7 @@ // -D <path> => path to the data; the data should be in <path>/Data/ // If WRITE_RESULT is defined, the result of the surface filter is saved. -//#define WRITE_RESULT +// #define WRITE_RESULT #include "vtkActor.h" #include "vtkDataArray.h" diff --git a/Filters/Modeling/vtkBandedPolyDataContourFilter.cxx b/Filters/Modeling/vtkBandedPolyDataContourFilter.cxx index 951943b93ba..2bec901bba4 100644 --- a/Filters/Modeling/vtkBandedPolyDataContourFilter.cxx +++ b/Filters/Modeling/vtkBandedPolyDataContourFilter.cxx @@ -754,8 +754,8 @@ int vtkBandedPolyDataContourFilter::RequestData(vtkInformation* vtkNotUsed(reque // Find the starting vertex, i.e. the vertex with the lowest scalar value, // and rotate the indexing array such that it is the first of the indices - auto indexed_less = [&polygon, &point_less]( - int i1, int i2) { return point_less(polygon[i1], polygon[i2]); }; + auto indexed_less = [&polygon, &point_less](int i1, int i2) + { return point_less(polygon[i1], polygon[i2]); }; std::rotate( index.begin(), std::min_element(index.begin(), index.end(), indexed_less), index.end()); @@ -798,7 +798,8 @@ int vtkBandedPolyDataContourFilter::RequestData(vtkInformation* vtkNotUsed(reque It l1 = index.end() - 1; while (r1 < l1) { - auto in_band = [&clip_scalar, &polygon](int i) { + auto in_band = [&clip_scalar, &polygon](int i) + { return (polygon[i].scalar == clip_scalar) || ((polygon[i].type == PointType::VERTEX && polygon[i].scalar > clip_scalar)); }; diff --git a/Filters/Parallel/vtkExtractCTHPart.h b/Filters/Parallel/vtkExtractCTHPart.h index b71c16ec52f..e3a1f3fa153 100644 --- a/Filters/Parallel/vtkExtractCTHPart.h +++ b/Filters/Parallel/vtkExtractCTHPart.h @@ -51,7 +51,7 @@ class vtkUnsignedCharArray; class vtkUnstructuredGrid; class vtkExtractCTHPartFragments; -//#define EXTRACT_USE_IMAGE_DATA 1 +// #define EXTRACT_USE_IMAGE_DATA 1 class VTKFILTERSPARALLEL_EXPORT vtkExtractCTHPart : public vtkMultiBlockDataSetAlgorithm { diff --git a/Filters/Parallel/vtkExtractUserDefinedPiece.cxx b/Filters/Parallel/vtkExtractUserDefinedPiece.cxx index 87e3bf20950..19d86c6bc1e 100644 --- a/Filters/Parallel/vtkExtractUserDefinedPiece.cxx +++ b/Filters/Parallel/vtkExtractUserDefinedPiece.cxx @@ -28,7 +28,7 @@ vtkExtractUserDefinedPiece::vtkExtractUserDefinedPiece() } vtkExtractUserDefinedPiece::~vtkExtractUserDefinedPiece() { - delete[](char*) this->ConstantData; + delete[] (char*)this->ConstantData; this->ConstantData = nullptr; } void vtkExtractUserDefinedPiece::PrintSelf(ostream& os, vtkIndent indent) diff --git a/Filters/Parallel/vtkHyperTreeGridPProbeFilter.cxx b/Filters/Parallel/vtkHyperTreeGridPProbeFilter.cxx index 6b794fb47b7..5484b0f1dab 100644 --- a/Filters/Parallel/vtkHyperTreeGridPProbeFilter.cxx +++ b/Filters/Parallel/vtkHyperTreeGridPProbeFilter.cxx @@ -253,7 +253,8 @@ public: this->ThreadGlobCellIds->SetNumberOfIds(nPointsFound); nPointsFound = 0; - auto mergeThreadResults = [&](LocalData& loc) { + auto mergeThreadResults = [&](LocalData& loc) + { std::copy( loc.pointIds.begin(), loc.pointIds.end(), this->ThreadGlobPointIds->begin() + nPointsFound); std::copy( @@ -353,7 +354,8 @@ bool vtkHyperTreeGridPProbeFilter::Reduce( else { auto dealWithRemote = [](vtkIdList* remotePointIds, vtkDataSet* remoteOutput, - vtkHyperTreeGrid* htgSource, vtkDataSet* totOutput) { + vtkHyperTreeGrid* htgSource, vtkDataSet* totOutput) + { if (remotePointIds->GetNumberOfIds() > 0) { vtkNew<vtkIdList> iotaIds; diff --git a/Filters/Parallel/vtkIntegrateAttributes.cxx b/Filters/Parallel/vtkIntegrateAttributes.cxx index 35240df5d61..59e55eb9c1c 100644 --- a/Filters/Parallel/vtkIntegrateAttributes.cxx +++ b/Filters/Parallel/vtkIntegrateAttributes.cxx @@ -705,7 +705,8 @@ void vtkIntegrateAttributes::vtkIntegrateAttributesFunctor::IntegrateData1( vtkDataSetAttributes* inda, vtkDataSetAttributes* outda, vtkIdType pt1Id, double k, vtkIntegrateAttributes::vtkFieldList& fieldList, int index) { - auto f = [pt1Id, k](vtkAbstractArray* ainArray, vtkAbstractArray* aoutArray) { + auto f = [pt1Id, k](vtkAbstractArray* ainArray, vtkAbstractArray* aoutArray) + { vtkDataArray* inArray = vtkDataArray::FastDownCast(ainArray); vtkDoubleArray* outArray = vtkDoubleArray::FastDownCast(aoutArray); if (inArray && outArray) @@ -730,7 +731,8 @@ void vtkIntegrateAttributes::vtkIntegrateAttributesFunctor::IntegrateData2( vtkDataSetAttributes* inda, vtkDataSetAttributes* outda, vtkIdType pt1Id, vtkIdType pt2Id, double k, vtkIntegrateAttributes::vtkFieldList& fieldList, int index) { - auto f = [pt1Id, pt2Id, k](vtkAbstractArray* ainArray, vtkAbstractArray* aoutArray) { + auto f = [pt1Id, pt2Id, k](vtkAbstractArray* ainArray, vtkAbstractArray* aoutArray) + { vtkDataArray* inArray = vtkDataArray::FastDownCast(ainArray); vtkDoubleArray* outArray = vtkDoubleArray::FastDownCast(aoutArray); if (inArray && outArray) @@ -757,7 +759,8 @@ void vtkIntegrateAttributes::vtkIntegrateAttributesFunctor::IntegrateData3( vtkDataSetAttributes* inda, vtkDataSetAttributes* outda, vtkIdType pt1Id, vtkIdType pt2Id, vtkIdType pt3Id, double k, vtkIntegrateAttributes::vtkFieldList& fieldList, int index) { - auto f = [pt1Id, pt2Id, pt3Id, k](vtkAbstractArray* ainArray, vtkAbstractArray* aoutArray) { + auto f = [pt1Id, pt2Id, pt3Id, k](vtkAbstractArray* ainArray, vtkAbstractArray* aoutArray) + { vtkDataArray* inArray = vtkDataArray::FastDownCast(ainArray); vtkDoubleArray* outArray = vtkDoubleArray::FastDownCast(aoutArray); if (inArray && outArray) @@ -785,8 +788,8 @@ void vtkIntegrateAttributes::vtkIntegrateAttributesFunctor::IntegrateData4( vtkIdType pt3Id, vtkIdType pt4Id, double k, vtkIntegrateAttributes::vtkFieldList& fieldList, int index) { - auto f = [pt1Id, pt2Id, pt3Id, pt4Id, k]( - vtkAbstractArray* ainArray, vtkAbstractArray* aoutArray) { + auto f = [pt1Id, pt2Id, pt3Id, pt4Id, k](vtkAbstractArray* ainArray, vtkAbstractArray* aoutArray) + { vtkDataArray* inArray = vtkDataArray::FastDownCast(ainArray); vtkDoubleArray* outArray = vtkDoubleArray::FastDownCast(aoutArray); if (inArray && outArray) diff --git a/Filters/Parallel/vtkPKdTree.cxx b/Filters/Parallel/vtkPKdTree.cxx index a0d1b44dbb4..6322ee8ddf4 100644 --- a/Filters/Parallel/vtkPKdTree.cxx +++ b/Filters/Parallel/vtkPKdTree.cxx @@ -608,7 +608,7 @@ typedef struct vtkNodeInfo_ int L; int level; int tag; -} * vtkNodeInfo; +}* vtkNodeInfo; #define ENQUEUE(a, b, c, d) \ do \ diff --git a/Filters/ParallelDIY2/Testing/Cxx/TestPStructuredGridGhostDataGenerator.cxx b/Filters/ParallelDIY2/Testing/Cxx/TestPStructuredGridGhostDataGenerator.cxx index 6832ee3aa46..e53835a7acc 100644 --- a/Filters/ParallelDIY2/Testing/Cxx/TestPStructuredGridGhostDataGenerator.cxx +++ b/Filters/ParallelDIY2/Testing/Cxx/TestPStructuredGridGhostDataGenerator.cxx @@ -32,7 +32,7 @@ #include "vtkUnsignedCharArray.h" #include "vtkXMLPMultiBlockDataWriter.h" -//#define DEBUG_ON +// #define DEBUG_ON namespace { diff --git a/Filters/ParallelDIY2/Testing/Cxx/TestPUniformGridGhostDataGenerator.cxx b/Filters/ParallelDIY2/Testing/Cxx/TestPUniformGridGhostDataGenerator.cxx index dbf29a93306..23c901ada63 100644 --- a/Filters/ParallelDIY2/Testing/Cxx/TestPUniformGridGhostDataGenerator.cxx +++ b/Filters/ParallelDIY2/Testing/Cxx/TestPUniformGridGhostDataGenerator.cxx @@ -28,7 +28,7 @@ #include "vtkUnsignedCharArray.h" #include "vtkXMLPMultiBlockDataWriter.h" -//#define DEBUG_ON +// #define DEBUG_ON namespace { diff --git a/Filters/ParallelDIY2/Testing/Cxx/TestProbeLineFilter.cxx b/Filters/ParallelDIY2/Testing/Cxx/TestProbeLineFilter.cxx index f4fbee880f6..fdc06688d1f 100644 --- a/Filters/ParallelDIY2/Testing/Cxx/TestProbeLineFilter.cxx +++ b/Filters/ParallelDIY2/Testing/Cxx/TestProbeLineFilter.cxx @@ -485,7 +485,8 @@ int Test2DProbingHTG(vtkMultiProcessController* contr) int retVal = EXIT_SUCCESS; - auto Check = [&probeLine, &contr, &retVal](int pattern) { + auto Check = [&probeLine, &contr, &retVal](int pattern) + { probeLine->SetSamplingPattern(pattern); probeLine->Update(); vtkDataSet* outDataSet = vtkDataSet::SafeDownCast(probeLine->GetOutput()); @@ -527,7 +528,8 @@ int Test3DProbingHTG(vtkMultiProcessController* contr) int retVal = EXIT_SUCCESS; - auto Check = [&probeLine, &contr, &retVal](int pattern) { + auto Check = [&probeLine, &contr, &retVal](int pattern) + { probeLine->SetSamplingPattern(pattern); probeLine->Update(); vtkDataSet* outDataSet = vtkDataSet::SafeDownCast(probeLine->GetOutput()); diff --git a/Filters/ParallelDIY2/Testing/Cxx/TestStructuredGridGhostDataGenerator.cxx b/Filters/ParallelDIY2/Testing/Cxx/TestStructuredGridGhostDataGenerator.cxx index 077567b1df1..0589b7f018b 100644 --- a/Filters/ParallelDIY2/Testing/Cxx/TestStructuredGridGhostDataGenerator.cxx +++ b/Filters/ParallelDIY2/Testing/Cxx/TestStructuredGridGhostDataGenerator.cxx @@ -31,7 +31,7 @@ #include "vtkUniformGrid.h" #include "vtkXMLMultiBlockDataWriter.h" -//#define DEBUG_ON +// #define DEBUG_ON namespace { diff --git a/Filters/ParallelDIY2/vtkAdaptiveResampleToImage.cxx b/Filters/ParallelDIY2/vtkAdaptiveResampleToImage.cxx index e9e3931373a..d71699e521b 100644 --- a/Filters/ParallelDIY2/vtkAdaptiveResampleToImage.cxx +++ b/Filters/ParallelDIY2/vtkAdaptiveResampleToImage.cxx @@ -134,18 +134,17 @@ bool merge(vtkImageData* target, std::vector<vtkSmartPointer<vtkImageData>>& sou auto inPD = sources[idx]->GetPointData(); if (auto ptids = get_ids(inPD, vtkDataSetAttributes::HIDDENPOINT)) { - ptList.TransformData(idx, inPD, opd, [&ptids](vtkAbstractArray* in, vtkAbstractArray* out) { - out->InsertTuples(ptids, ptids, in); - }); + ptList.TransformData(idx, inPD, opd, + [&ptids](vtkAbstractArray* in, vtkAbstractArray* out) + { out->InsertTuples(ptids, ptids, in); }); } auto inCD = sources[idx]->GetCellData(); if (auto cellids = get_ids(inCD, vtkDataSetAttributes::HIDDENCELL)) { - cellList.TransformData( - idx, inCD, ocd, [&cellids](vtkAbstractArray* in, vtkAbstractArray* out) { - out->InsertTuples(cellids, cellids, in); - }); + cellList.TransformData(idx, inCD, ocd, + [&cellids](vtkAbstractArray* in, vtkAbstractArray* out) + { out->InsertTuples(cellids, cellids, in); }); } } return true; @@ -218,7 +217,8 @@ int vtkAdaptiveResampleToImage::RequestData( const auto localBounds = vtkDIYUtilities::GetLocalBounds(inputDO); std::transform(boxes.begin(), boxes.end(), resamples.begin(), - [&inputDO, &localBounds, this](const vtkBoundingBox& bbox) { + [&inputDO, &localBounds, this](const vtkBoundingBox& bbox) + { std::vector<vtkSmartPointer<vtkImageData>> retval; vtkSmartPointer<vtkImageData> img = localBounds.Intersects(bbox) ? impl::resample(bbox, inputDO, this) : nullptr; @@ -231,52 +231,54 @@ int vtkAdaptiveResampleToImage::RequestData( vtkLogEndScope("local resample"); vtkLogStartScope(TRACE, "global exchange"); - diy::all_to_all(master, assigner, [&resamples, &comm](vtkImageData*, const diy::ReduceProxy& rp) { - if (rp.in_link().size() == 0) + diy::all_to_all(master, assigner, + [&resamples, &comm](vtkImageData*, const diy::ReduceProxy& rp) { - // 1. enqueue - const auto& out_link = rp.out_link(); - for (int cc = 0, max = out_link.size(); cc < max; ++cc) + if (rp.in_link().size() == 0) { - // resample input to image. - const auto target = out_link.target(cc); - auto& image_vector = resamples[target.gid]; - if (!image_vector.empty() && target.proc != comm.rank()) + // 1. enqueue + const auto& out_link = rp.out_link(); + for (int cc = 0, max = out_link.size(); cc < max; ++cc) { - // send non-empty data to non-local block only. - assert(image_vector.size() == 1); - auto image = image_vector[0]; - rp.enqueue<vtkDataSet*>(target, image); - // vtkLogF(TRACE, "enqueue for %d", target.gid); - image_vector.clear(); // free up memory + // resample input to image. + const auto target = out_link.target(cc); + auto& image_vector = resamples[target.gid]; + if (!image_vector.empty() && target.proc != comm.rank()) + { + // send non-empty data to non-local block only. + assert(image_vector.size() == 1); + auto image = image_vector[0]; + rp.enqueue<vtkDataSet*>(target, image); + // vtkLogF(TRACE, "enqueue for %d", target.gid); + image_vector.clear(); // free up memory + } } } - } - else - { - // 2. dequeue - const auto& in_link = rp.in_link(); - for (int cc = 0, max = in_link.size(); cc < max; ++cc) + else { - const auto source = in_link.target(cc); - if (rp.incoming(source.gid).empty()) + // 2. dequeue + const auto& in_link = rp.in_link(); + for (int cc = 0, max = in_link.size(); cc < max; ++cc) { - continue; - } - - vtkDataSet* ptr = nullptr; - rp.dequeue<vtkDataSet*>(source, ptr); - if (ptr) - { - // vtkLogF(TRACE, "dequeue from %d", source.gid); - auto img = vtkImageData::SafeDownCast(ptr); - assert(img); - resamples[rp.gid()].emplace_back(img); - ptr->Delete(); + const auto source = in_link.target(cc); + if (rp.incoming(source.gid).empty()) + { + continue; + } + + vtkDataSet* ptr = nullptr; + rp.dequeue<vtkDataSet*>(source, ptr); + if (ptr) + { + // vtkLogF(TRACE, "dequeue from %d", source.gid); + auto img = vtkImageData::SafeDownCast(ptr); + assert(img); + resamples[rp.gid()].emplace_back(img); + ptr->Delete(); + } } } - } - }); + }); vtkLogEndScope("global exchange"); // remove null images. @@ -288,7 +290,8 @@ int vtkAdaptiveResampleToImage::RequestData( auto outputPD = vtkPartitionedDataSet::GetData(outputVector, 0); master.foreach ( - [&outputPD, &resamples](vtkImageData* block, const diy::Master::ProxyWithLink& ln) { + [&outputPD, &resamples](vtkImageData* block, const diy::Master::ProxyWithLink& ln) + { if (impl::merge(block, resamples[ln.gid()])) { outputPD->SetPartition(outputPD->GetNumberOfPartitions(), block); diff --git a/Filters/ParallelDIY2/vtkDIYKdTreeUtilities.cxx b/Filters/ParallelDIY2/vtkDIYKdTreeUtilities.cxx index 2225f2d367b..f3f48939d4a 100644 --- a/Filters/ParallelDIY2/vtkDIYKdTreeUtilities.cxx +++ b/Filters/ParallelDIY2/vtkDIYKdTreeUtilities.cxx @@ -65,8 +65,9 @@ struct BlockT const auto start_offset = this->Points.size(); this->Points.resize(start_offset + pts->GetNumberOfPoints()); - vtkSMPTools::For( - 0, pts->GetNumberOfPoints(), [this, pts, start_offset](vtkIdType start, vtkIdType end) { + vtkSMPTools::For(0, pts->GetNumberOfPoints(), + [this, pts, start_offset](vtkIdType start, vtkIdType end) + { for (vtkIdType cc = start; cc < end; ++cc) { auto& pt = this->Points[cc + start_offset]; @@ -247,27 +248,29 @@ std::vector<vtkBoundingBox> vtkDIYKdTreeUtilities::GenerateCuts( diy::kdtree(master, cuts_assigner, 3, gdomain, &BlockT::Points, /*hist_bins=*/256); // collect bounds for all blocks globally. - diy::all_to_all(master, cuts_assigner, [](void* b, const diy::ReduceProxy& srp) { - BlockT* block = reinterpret_cast<BlockT*>(b); - if (srp.round() == 0) + diy::all_to_all(master, cuts_assigner, + [](void* b, const diy::ReduceProxy& srp) { - for (int i = 0; i < srp.out_link().size(); ++i) + BlockT* block = reinterpret_cast<BlockT*>(b); + if (srp.round() == 0) { - auto link = static_cast<diy::RegularContinuousLink*>( - srp.master()->link(srp.master()->lid(srp.gid()))); - srp.enqueue(srp.out_link().target(i), link->bounds()); + for (int i = 0; i < srp.out_link().size(); ++i) + { + auto link = static_cast<diy::RegularContinuousLink*>( + srp.master()->link(srp.master()->lid(srp.gid()))); + srp.enqueue(srp.out_link().target(i), link->bounds()); + } } - } - else - { - block->BlockBounds.resize(srp.in_link().size()); - for (int i = 0; i < srp.in_link().size(); ++i) + else { - assert(i == srp.in_link().target(i).gid); - srp.dequeue(srp.in_link().target(i).gid, block->BlockBounds[i]); + block->BlockBounds.resize(srp.in_link().size()); + for (int i = 0; i < srp.in_link().size(); ++i) + { + assert(i == srp.in_link().target(i).gid); + srp.dequeue(srp.in_link().target(i).gid, block->BlockBounds[i]); + } } - } - }); + }); std::vector<vtkBoundingBox> cuts(num_cuts); if (master.size() > 0) @@ -329,7 +332,8 @@ vtkSmartPointer<vtkPartitionedDataSet> vtkDIYKdTreeUtilities::Exchange( const int myrank = comm.rank(); diy::all_to_all(master, assigner, - [block_assigner, &myrank, localParts](VectorOfVectorOfUG* block, const diy::ReduceProxy& rp) { + [block_assigner, &myrank, localParts](VectorOfVectorOfUG* block, const diy::ReduceProxy& rp) + { if (rp.in_link().size() == 0) { // enqueue blocks to send. diff --git a/Filters/ParallelDIY2/vtkExtractSubsetWithSeed.cxx b/Filters/ParallelDIY2/vtkExtractSubsetWithSeed.cxx index 6705da6f557..44f37aec3ea 100644 --- a/Filters/ParallelDIY2/vtkExtractSubsetWithSeed.cxx +++ b/Filters/ParallelDIY2/vtkExtractSubsetWithSeed.cxx @@ -396,7 +396,8 @@ int vtkExtractSubsetWithSeed::RequestData( auto datasets = vtkCompositeDataSet::GetDataSets(input); // prune non-structured grid datasets. - auto prunePredicate = [](vtkDataObject* ds) { + auto prunePredicate = [](vtkDataObject* ds) + { auto sg = vtkStructuredGrid::SafeDownCast(ds); // skip empty or non-3D grids. return sg == nullptr || @@ -443,42 +444,44 @@ int vtkExtractSubsetWithSeed::RequestData( // exchange bounding boxes to determine neighbours. vtkLogStartScope(TRACE, "populate block neighbours"); std::map<int, std::vector<int>> neighbors; - diy::all_to_all(master, assigner, [&neighbors](BlockT* b, const diy::ReduceProxy& rp) { - vtkBoundingBox bbox; - if (b->Input) + diy::all_to_all(master, assigner, + [&neighbors](BlockT* b, const diy::ReduceProxy& rp) { - double bds[6]; - b->Input->GetBounds(bds); - bbox.SetBounds(bds); - bbox.Inflate(0.000001); - } + vtkBoundingBox bbox; + if (b->Input) + { + double bds[6]; + b->Input->GetBounds(bds); + bbox.SetBounds(bds); + bbox.Inflate(0.000001); + } - if (rp.round() == 0) - { - double bds[6]; - bbox.GetBounds(bds); - for (int i = 0; i < rp.out_link().size(); ++i) + if (rp.round() == 0) { - const auto dest = rp.out_link().target(i); - rp.enqueue(dest, bds, 6); + double bds[6]; + bbox.GetBounds(bds); + for (int i = 0; i < rp.out_link().size(); ++i) + { + const auto dest = rp.out_link().target(i); + rp.enqueue(dest, bds, 6); + } } - } - else - { - for (int i = 0; i < rp.in_link().size(); ++i) + else { - const auto src = rp.in_link().target(i); - double in_bds[6]; - rp.dequeue(src, in_bds, 6); - vtkBoundingBox in_bbx(in_bds); - if (src.gid != rp.gid() && in_bbx.IsValid() && bbox.IsValid() && in_bbx.Intersects(bbox)) + for (int i = 0; i < rp.in_link().size(); ++i) { - vtkLogF(TRACE, "%d --> %d", rp.gid(), src.gid); - neighbors[rp.gid()].push_back(src.gid); + const auto src = rp.in_link().target(i); + double in_bds[6]; + rp.dequeue(src, in_bds, 6); + vtkBoundingBox in_bbx(in_bds); + if (src.gid != rp.gid() && in_bbx.IsValid() && bbox.IsValid() && in_bbx.Intersects(bbox)) + { + vtkLogF(TRACE, "%d --> %d", rp.gid(), src.gid); + neighbors[rp.gid()].push_back(src.gid); + } } } - } - }); + }); // update local links. for (auto& pair : neighbors) @@ -523,68 +526,70 @@ int vtkExtractSubsetWithSeed::RequestData( int round = 0; while (!all_done) { - master.foreach ([this, &round, &propagation_mask]( - BlockT* b, const diy::Master::ProxyWithLink& cp) { - std::vector<SeedT> seeds; - if (round == 0) + master.foreach ( + [this, &round, &propagation_mask](BlockT* b, const diy::Master::ProxyWithLink& cp) { - const vtkIdType cellid = - (b->Input != nullptr) ? b->CellLocator->FindCell(this->GetSeed()) : -1; - if (cellid >= 0) + std::vector<SeedT> seeds; + if (round == 0) { - auto p_vecs = ::GetPropagationVectors(b->Input->GetCell(cellid), propagation_mask); - seeds.emplace_back(vtkVector3d(this->GetSeed()), p_vecs.first, p_vecs.second); + const vtkIdType cellid = + (b->Input != nullptr) ? b->CellLocator->FindCell(this->GetSeed()) : -1; + if (cellid >= 0) + { + auto p_vecs = ::GetPropagationVectors(b->Input->GetCell(cellid), propagation_mask); + seeds.emplace_back(vtkVector3d(this->GetSeed()), p_vecs.first, p_vecs.second); + } } - } - else - { - // dequeue - std::vector<int> incoming; - cp.incoming(incoming); - for (const int& gid : incoming) + else { - if (!cp.incoming(gid).empty()) + // dequeue + std::vector<int> incoming; + cp.incoming(incoming); + for (const int& gid : incoming) { - assert(b->Input != nullptr); // we should not be getting messages if we don't have data! - std::vector<SeedT> next_seeds; - cp.dequeue(gid, next_seeds); - seeds.insert(seeds.end(), next_seeds.begin(), next_seeds.end()); + if (!cp.incoming(gid).empty()) + { + assert( + b->Input != nullptr); // we should not be getting messages if we don't have data! + std::vector<SeedT> next_seeds; + cp.dequeue(gid, next_seeds); + seeds.insert(seeds.end(), next_seeds.begin(), next_seeds.end()); + } } } - } - std::vector<SeedT> next_seeds; - for (const auto& seed : seeds) - { - std::vector<vtkVector3d> dirs; - if (std::get<1>(seed).SquaredNorm() != 0) - { - dirs.push_back(std::get<1>(seed)); - } - if (std::get<2>(seed).SquaredNorm() != 0) + std::vector<SeedT> next_seeds; + for (const auto& seed : seeds) { - dirs.push_back(std::get<2>(seed)); + std::vector<vtkVector3d> dirs; + if (std::get<1>(seed).SquaredNorm() != 0) + { + dirs.push_back(std::get<1>(seed)); + } + if (std::get<2>(seed).SquaredNorm() != 0) + { + dirs.push_back(std::get<2>(seed)); + } + auto new_seeds = ::ExtractSliceFromSeed(std::get<0>(seed), dirs, b, cp); + next_seeds.insert(next_seeds.end(), new_seeds.begin(), new_seeds.end()); } - auto new_seeds = ::ExtractSliceFromSeed(std::get<0>(seed), dirs, b, cp); - next_seeds.insert(next_seeds.end(), new_seeds.begin(), new_seeds.end()); - } - if (!next_seeds.empty()) - { - // enqueue - for (const auto& neighbor : cp.link()->neighbors()) + if (!next_seeds.empty()) { - vtkLogF( - TRACE, "r=%d: enqueuing %d --> (%d, %d)", round, cp.gid(), neighbor.gid, neighbor.proc); - cp.enqueue(neighbor, next_seeds); + // enqueue + for (const auto& neighbor : cp.link()->neighbors()) + { + vtkLogF(TRACE, "r=%d: enqueuing %d --> (%d, %d)", round, cp.gid(), neighbor.gid, + neighbor.proc); + cp.enqueue(neighbor, next_seeds); + } } - } - cp.collectives()->clear(); + cp.collectives()->clear(); - const int has_seeds = static_cast<int>(!next_seeds.empty()); - cp.all_reduce(has_seeds, std::logical_or<int>()); - }); + const int has_seeds = static_cast<int>(!next_seeds.empty()); + cp.all_reduce(has_seeds, std::logical_or<int>()); + }); vtkLogF(TRACE, "r=%d, exchange", round); master.exchange(); all_done = (master.proxy(master.loaded_block()).read<int>() == 0); @@ -622,12 +627,14 @@ int vtkExtractSubsetWithSeed::RequestData( auto inputPDS = inputPDC->GetPartitionedDataSet(cc); for (unsigned int kk = 0, maxKK = inputPDS->GetNumberOfPartitions(); kk < maxKK; ++kk) { - master.foreach ([&](BlockT* b, const diy::Master::ProxyWithLink&) { - if (b->Input == inputPDS->GetPartition(kk)) + master.foreach ( + [&](BlockT* b, const diy::Master::ProxyWithLink&) { - b->AddExtracts(pds); - } - }); + if (b->Input == inputPDS->GetPartition(kk)) + { + b->AddExtracts(pds); + } + }); } } } @@ -701,7 +708,8 @@ int vtkExtractSubsetWithSeed::RequestData( std::function<vtkDataObject*(vtkDataObject*)> replaceLeaves; replaceLeaves = [&replaceLeaves, &input_dataset_map, &output_blocks]( - vtkDataObject* output) -> vtkDataObject* { + vtkDataObject* output) -> vtkDataObject* + { if (auto mb = vtkMultiBlockDataSet::SafeDownCast(output)) { for (unsigned int cc = 0; cc < mb->GetNumberOfBlocks(); ++cc) diff --git a/Filters/ParallelDIY2/vtkGenerateGlobalIds.cxx b/Filters/ParallelDIY2/vtkGenerateGlobalIds.cxx index 2b528578ade..b271cdf2911 100644 --- a/Filters/ParallelDIY2/vtkGenerateGlobalIds.cxx +++ b/Filters/ParallelDIY2/vtkGenerateGlobalIds.cxx @@ -92,7 +92,8 @@ static bool GenerateIds(vtkDataObject* dobj, vtkGenerateGlobalIds* self, bool ce vtkLogStartScope(TRACE, "extract points"); auto datasets = vtkCompositeDataSet::GetDataSets(dobj); datasets.erase(std::remove_if(datasets.begin(), datasets.end(), - [&cell_centers](vtkDataSet* ds) { + [&cell_centers](vtkDataSet* ds) + { return ds == nullptr || ds->GetNumberOfPoints() == 0 || (cell_centers && ds->GetNumberOfCells() == 0); }), @@ -151,71 +152,79 @@ static bool GenerateIds(vtkDataObject* dobj, vtkGenerateGlobalIds* self, bool ce // now communicate point ownership information and assign ids to locally owned // points. vtkLogStartScope(TRACE, "exchange-ownership-ids"); - diy::all_to_all(master, assigner, [](ElementBlockT* b, const diy::ReduceProxy& rp) { - if (rp.round() == 0) + diy::all_to_all(master, assigner, + [](ElementBlockT* b, const diy::ReduceProxy& rp) { - // now enqueue ownership information. - b->EnqueueOwnershipInformation(rp); - } - else - { - // now dequeue ownership information and process locally to assign ids - // to locally owned points and flag ghost points. - b->DequeueOwnershipInformation(rp); - } - }); + if (rp.round() == 0) + { + // now enqueue ownership information. + b->EnqueueOwnershipInformation(rp); + } + else + { + // now dequeue ownership information and process locally to assign ids + // to locally owned points and flag ghost points. + b->DequeueOwnershipInformation(rp); + } + }); vtkLogEndScope("exchange-ownership-ids"); // exchange unique ids count so that we can determine global id offsets vtkLogStartScope(TRACE, "exchange-unique-ids"); - diy::all_to_all(master, assigner, [](ElementBlockT* b, const diy::ReduceProxy& rp) { - if (rp.round() == 0) + diy::all_to_all(master, assigner, + [](ElementBlockT* b, const diy::ReduceProxy& rp) { - for (int i = rp.gid() + 1; i < rp.nblocks(); ++i) + if (rp.round() == 0) { - rp.enqueue(rp.out_link().target(i), b->UniqueElementsCount); + for (int i = rp.gid() + 1; i < rp.nblocks(); ++i) + { + rp.enqueue(rp.out_link().target(i), b->UniqueElementsCount); + } } - } - else - { - vtkIdType offset = 0; - for (int src_gid = 0; src_gid < rp.gid(); ++src_gid) + else { - vtkIdType msg; - rp.dequeue(src_gid, msg); - offset += msg; + vtkIdType offset = 0; + for (int src_gid = 0; src_gid < rp.gid(); ++src_gid) + { + vtkIdType msg; + rp.dequeue(src_gid, msg); + offset += msg; + } + b->AddOffset(offset); } - b->AddOffset(offset); - } - }); + }); vtkLogEndScope("exchange-unique-ids"); // exchange assigned ids. vtkLogStartScope(TRACE, "exchange-assigned-ids"); - diy::all_to_all(master, assigner, [](ElementBlockT* b, const diy::ReduceProxy& rp) { - if (rp.round() == 0) - { - b->EnqueueReplies(rp); - } - else + diy::all_to_all(master, assigner, + [](ElementBlockT* b, const diy::ReduceProxy& rp) { - b->DequeueReplies(rp); - } - }); + if (rp.round() == 0) + { + b->EnqueueReplies(rp); + } + else + { + b->DequeueReplies(rp); + } + }); vtkLogEndScope("exchange-assigned-ids"); // final back communication to assign ids to ghosted points. vtkLogStartScope(TRACE, "exchange-ghosted-ids"); - diy::all_to_all(master, assigner, [](ElementBlockT* b, const diy::ReduceProxy& rp) { - if (rp.round() == 0) + diy::all_to_all(master, assigner, + [](ElementBlockT* b, const diy::ReduceProxy& rp) { - b->EnqueueGhostedIds(rp); - } - else - { - b->DequeueGhostedIds(rp); - } - }); + if (rp.round() == 0) + { + b->EnqueueGhostedIds(rp); + } + else + { + b->DequeueGhostedIds(rp); + } + }); vtkLogEndScope("exchange-ghosted-ids"); self->UpdateProgress(1.0); return true; @@ -283,8 +292,9 @@ struct PointTT { std::vector<PointTT> elems; elems.resize(pts->GetNumberOfPoints()); - vtkSMPTools::For( - 0, pts->GetNumberOfPoints(), [&elems, pts, gid](vtkIdType start, vtkIdType end) { + vtkSMPTools::For(0, pts->GetNumberOfPoints(), + [&elems, pts, gid](vtkIdType start, vtkIdType end) + { for (vtkIdType cc = start; cc < end; ++cc) { auto& pt = elems[cc]; @@ -301,10 +311,12 @@ struct PointTT // let's sort the points by source-id. This ensures that when a point is // duplicated among multiple blocks, the block with lower block-id owns the // point. Thus, keeping the numbering consistent. - std::sort(points.begin(), points.end(), [](const PointTT& a, const PointTT& b) { - return (a.source_gid == b.source_gid) ? (a.source_id < b.source_id) - : (a.source_gid < b.source_gid); - }); + std::sort(points.begin(), points.end(), + [](const PointTT& a, const PointTT& b) + { + return (a.source_gid == b.source_gid) ? (a.source_id < b.source_id) + : (a.source_gid < b.source_gid); + }); } static std::vector<vtkIdType> GenerateMergeMap( @@ -322,12 +334,14 @@ struct PointTT vtkNew<vtkPoints> pts; pts->SetDataTypeToDouble(); pts->SetNumberOfPoints(numPts); - vtkSMPTools::For(0, numPts, [&](vtkIdType start, vtkIdType end) { - for (vtkIdType cc = start; cc < end; ++cc) + vtkSMPTools::For(0, numPts, + [&](vtkIdType start, vtkIdType end) { - pts->SetPoint(cc, points[cc].coords.GetData()); - } - }); + for (vtkIdType cc = start; cc < end; ++cc) + { + pts->SetPoint(cc, points[cc].coords.GetData()); + } + }); grid->SetPoints(pts); vtkNew<vtkStaticPointLocator> locator; @@ -373,23 +387,25 @@ struct CellTT auto pt_gids = vtkIdTypeArray::SafeDownCast(ds->GetPointData()->GetGlobalIds()); assert(ncells == 0 || pt_gids != nullptr); - vtkSMPTools::For(0, ncells, [&](vtkIdType start, vtkIdType end) { - auto ids = tlIdList.Local(); - for (vtkIdType cc = start; cc < end; ++cc) + vtkSMPTools::For(0, ncells, + [&](vtkIdType start, vtkIdType end) { - auto& cell = elems[cc]; - centers->GetPoint(cc, cell.center.GetData()); - cell.source_gid = gid; - cell.source_id = cc; - - ds->GetCellPoints(cc, ids); - cell.point_ids.resize(ids->GetNumberOfIds()); - for (vtkIdType kk = 0, max = ids->GetNumberOfIds(); kk < max; ++kk) + auto ids = tlIdList.Local(); + for (vtkIdType cc = start; cc < end; ++cc) { - cell.point_ids[kk] = pt_gids->GetTypedComponent(ids->GetId(kk), 0); + auto& cell = elems[cc]; + centers->GetPoint(cc, cell.center.GetData()); + cell.source_gid = gid; + cell.source_id = cc; + + ds->GetCellPoints(cc, ids); + cell.point_ids.resize(ids->GetNumberOfIds()); + for (vtkIdType kk = 0, max = ids->GetNumberOfIds(); kk < max; ++kk) + { + cell.point_ids[kk] = pt_gids->GetTypedComponent(ids->GetId(kk), 0); + } } - } - }); + }); return elems; } @@ -399,10 +415,12 @@ struct CellTT // here, we are sorting such that for duplicated cells, we always order the // cell on the lower block before the one on the higher block. This is // essential to keep the cell numbering consistent. - std::sort(cells.begin(), cells.end(), [](const CellTT& lhs, const CellTT& rhs) { - return (lhs.point_ids == rhs.point_ids ? lhs.source_gid < rhs.source_gid - : lhs.point_ids < rhs.point_ids); - }); + std::sort(cells.begin(), cells.end(), + [](const CellTT& lhs, const CellTT& rhs) + { + return (lhs.point_ids == rhs.point_ids ? lhs.source_gid < rhs.source_gid + : lhs.point_ids < rhs.point_ids); + }); } static std::vector<vtkIdType> GenerateMergeMap( @@ -596,8 +614,9 @@ public: { return; } - vtkSMPTools::For( - 0, this->GlobalIds->GetNumberOfTuples(), [&offset, this](vtkIdType start, vtkIdType end) { + vtkSMPTools::For(0, this->GlobalIds->GetNumberOfTuples(), + [&offset, this](vtkIdType start, vtkIdType end) + { for (vtkIdType cc = start; cc < end; ++cc) { const auto id = this->GlobalIds->GetTypedComponent(cc, 0); diff --git a/Filters/ParallelDIY2/vtkNativePartitioningStrategy.cxx b/Filters/ParallelDIY2/vtkNativePartitioningStrategy.cxx index eea8534a4fc..b530e13f65b 100644 --- a/Filters/ParallelDIY2/vtkNativePartitioningStrategy.cxx +++ b/Filters/ParallelDIY2/vtkNativePartitioningStrategy.cxx @@ -163,32 +163,34 @@ vtkPartitioningStrategy::PartitionInformation CutsToPartition( vtkSMPThreadLocalObject<vtkGenericCell> gcellLO; vtkSMPThreadLocal<std::vector<double>> weightsLO; const int maxCellSize = dataset->GetMaxCellSize(); - vtkSMPTools::For(0, numCells, [&](vtkIdType first, vtkIdType last) { - auto gcell = gcellLO.Local(); - auto weights = weightsLO.Local(); - weights.resize(static_cast<size_t>(maxCellSize)); - for (vtkIdType cellId = first; cellId < last; ++cellId) + vtkSMPTools::For(0, numCells, + [&](vtkIdType first, vtkIdType last) { - if (ghostCells != nullptr && - ((ghostCells->GetTypedComponent(cellId, 0) & vtkDataSetAttributes::DUPLICATECELL) != 0)) + auto gcell = gcellLO.Local(); + auto weights = weightsLO.Local(); + weights.resize(static_cast<size_t>(maxCellSize)); + for (vtkIdType cellId = first; cellId < last; ++cellId) { - // skip ghost cells, they will not be extracted since they will be - // extracted on ranks where they are not marked as ghosts. - continue; - } - dataset->GetCell(cellId, gcell); - double cellBounds[6]; - dataset->GetCellBounds(cellId, cellBounds); - for (int cutId = 0; cutId < static_cast<int>(kdnodes.size()); ++cutId) - { - if (kdnodes[cutId]->IntersectsCell( - gcell, /*useDataBounds*/ 0, /*cellRegion*/ -1, cellBounds)) + if (ghostCells != nullptr && + ((ghostCells->GetTypedComponent(cellId, 0) & vtkDataSetAttributes::DUPLICATECELL) != 0)) { - cellRegions[cellId].emplace_back(cutId); + // skip ghost cells, they will not be extracted since they will be + // extracted on ranks where they are not marked as ghosts. + continue; + } + dataset->GetCell(cellId, gcell); + double cellBounds[6]; + dataset->GetCellBounds(cellId, cellBounds); + for (int cutId = 0; cutId < static_cast<int>(kdnodes.size()); ++cutId) + { + if (kdnodes[cutId]->IntersectsCell( + gcell, /*useDataBounds*/ 0, /*cellRegion*/ -1, cellBounds)) + { + cellRegions[cellId].emplace_back(cutId); + } } } - } - }); + }); vtkPartitioningStrategy::PartitionInformation res; ::PartitionDistributionWorklet worker(&res, dataset, &cuts, &cellRegions); diff --git a/Filters/ParallelDIY2/vtkOverlappingCellsDetector.cxx b/Filters/ParallelDIY2/vtkOverlappingCellsDetector.cxx index c7c1dfadf2e..8f1b366a746 100644 --- a/Filters/ParallelDIY2/vtkOverlappingCellsDetector.cxx +++ b/Filters/ParallelDIY2/vtkOverlappingCellsDetector.cxx @@ -143,7 +143,8 @@ std::map<int, vtkSmartPointer<vtkUnstructuredGrid>> ExtractOverlappingCellCandid std::transform(boundingBoxes.cbegin(), boundingBoxes.cend(), std::inserter(cactptidList, cactptidList.begin()), [pointsType]( - const std::pair<int, vtkBoundingBox> pair) -> std::pair<int, CellArrayCellTypePointsIdTuple> { + const std::pair<int, vtkBoundingBox> pair) -> std::pair<int, CellArrayCellTypePointsIdTuple> + { return std::pair<int, CellArrayCellTypePointsIdTuple>(pair.first, CellArrayCellTypePointsIdTuple(vtkSmartPointer<vtkCellArray>::Take(vtkCellArray::New()), vtkSmartPointer<vtkUnsignedCharArray>::Take(vtkUnsignedCharArray::New()), @@ -393,34 +394,36 @@ int vtkOverlappingCellsDetector::ExposeOverlappingCellsAmongBlocks( // First, we share bounding boxes with other blocks vtkLogStartScope(TRACE, "share bounding boxes"); - diy::all_to_all(master, assigner, [&master, &outputs](Block* block, const diy::ReduceProxy& srp) { - int myBlockId = srp.gid(); - int localId = master.lid(myBlockId); - auto& output = outputs[localId]; - if (srp.round() == 0) + diy::all_to_all(master, assigner, + [&master, &outputs](Block* block, const diy::ReduceProxy& srp) { - for (int i = 0; i < srp.out_link().size(); ++i) + int myBlockId = srp.gid(); + int localId = master.lid(myBlockId); + auto& output = outputs[localId]; + if (srp.round() == 0) { - if (i != myBlockId) + for (int i = 0; i < srp.out_link().size(); ++i) { - srp.enqueue(srp.out_link().target(i), output->GetBounds(), 6); + if (i != myBlockId) + { + srp.enqueue(srp.out_link().target(i), output->GetBounds(), 6); + } } } - } - else - { - double boundstmp[6]; - for (int i = 0; i < static_cast<int>(srp.in_link().size()); ++i) + else { - if (i != myBlockId) + double boundstmp[6]; + for (int i = 0; i < static_cast<int>(srp.in_link().size()); ++i) { - const diy::BlockID& blockId = srp.in_link().target(i); - srp.dequeue(blockId, boundstmp, 6); - block->BoundingBoxes.emplace(blockId.gid, vtkBoundingBox(boundstmp)); + if (i != myBlockId) + { + const diy::BlockID& blockId = srp.in_link().target(i); + srp.dequeue(blockId, boundstmp, 6); + block->BoundingBoxes.emplace(blockId.gid, vtkBoundingBox(boundstmp)); + } } } - } - }); + }); vtkLogEndScope("share bounding boxes"); std::vector<std::map<int, vtkBoundingBox>> boundingBoxesArray; @@ -446,7 +449,8 @@ int vtkOverlappingCellsDetector::ExposeOverlappingCellsAmongBlocks( // overlaps. // After this diy communication, the link map is symmetric among blocks. diy::all_to_all(master, assigner, - [&master, &overlappingCellCandidatesDataSetsArray](Block*, const diy::ReduceProxy& rp) { + [&master, &overlappingCellCandidatesDataSetsArray](Block*, const diy::ReduceProxy& rp) + { int myBlockId = rp.gid(); int localId = master.lid(myBlockId); auto& overlappingCellCandidatesDataSets = overlappingCellCandidatesDataSetsArray[localId]; @@ -491,34 +495,37 @@ int vtkOverlappingCellsDetector::ExposeOverlappingCellsAmongBlocks( // We share overlapping candidates with neighbor blocks. vtkLogStartScope(TRACE, "send cell candidates across ranks"); - master.foreach ([&master, &overlappingCellCandidatesDataSetsArray]( - void*, const diy::Master::ProxyWithLink& cp) { - int myBlockId = cp.gid(); - int localId = master.lid(myBlockId); - auto& candidates = overlappingCellCandidatesDataSetsArray[localId]; - // enqueue - for (int i = 0; i < static_cast<int>(cp.link()->size()); ++i) + master.foreach ( + [&master, &overlappingCellCandidatesDataSetsArray](void*, const diy::Master::ProxyWithLink& cp) { - vtkdiy2::BlockID& targetBlockId = cp.link()->target(i); - cp.enqueue<vtkDataSet*>(targetBlockId, candidates.at(targetBlockId.gid)); - } - }); + int myBlockId = cp.gid(); + int localId = master.lid(myBlockId); + auto& candidates = overlappingCellCandidatesDataSetsArray[localId]; + // enqueue + for (int i = 0; i < static_cast<int>(cp.link()->size()); ++i) + { + vtkdiy2::BlockID& targetBlockId = cp.link()->target(i); + cp.enqueue<vtkDataSet*>(targetBlockId, candidates.at(targetBlockId.gid)); + } + }); master.exchange(); - master.foreach ([](Block* block, const diy::Master::ProxyWithLink& cp) { - // dequeue - std::vector<int> incoming; - cp.incoming(incoming); - for (int gid : incoming) + master.foreach ( + [](Block* block, const diy::Master::ProxyWithLink& cp) { - // we need this extra check because incoming is not empty when using only one block - if (!cp.incoming(gid).empty()) + // dequeue + std::vector<int> incoming; + cp.incoming(incoming); + for (int gid : incoming) { - vtkDataSet* ds = nullptr; - cp.dequeue<vtkDataSet*>(gid, ds); - block->DataSets.emplace(gid, vtkSmartPointer<vtkDataSet>::Take(ds)); + // we need this extra check because incoming is not empty when using only one block + if (!cp.incoming(gid).empty()) + { + vtkDataSet* ds = nullptr; + cp.dequeue<vtkDataSet*>(gid, ds); + block->DataSets.emplace(gid, vtkSmartPointer<vtkDataSet>::Take(ds)); + } } - } - }); + }); vtkLogEndScope("send cell candidates across ranks"); std::vector<std::map<int, std::unordered_map<vtkIdType, std::set<vtkIdType>>>> @@ -594,7 +601,8 @@ int vtkOverlappingCellsDetector::ExposeOverlappingCellsAmongBlocks( // can add the collisions they couldn't detect. vtkLogStartScope(TRACE, "send back detected overlaps"); master.foreach ( - [&master, &collisionListMapListArray](void*, const diy::Master::ProxyWithLink& cp) { + [&master, &collisionListMapListArray](void*, const diy::Master::ProxyWithLink& cp) + { int myBlockId = cp.gid(); int localId = master.lid(myBlockId); auto& collisionListMapList = collisionListMapListArray[localId]; @@ -606,20 +614,22 @@ int vtkOverlappingCellsDetector::ExposeOverlappingCellsAmongBlocks( } }); master.exchange(); - master.foreach ([](Block* block, const diy::Master::ProxyWithLink& cp) { - // dequeue - std::vector<int> incoming; - cp.incoming(incoming); - for (int gid : incoming) + master.foreach ( + [](Block* block, const diy::Master::ProxyWithLink& cp) { - if (!cp.incoming(gid).empty()) + // dequeue + std::vector<int> incoming; + cp.incoming(incoming); + for (int gid : incoming) { - std::unordered_map<vtkIdType, std::set<vtkIdType>> collisionListMap; - cp.dequeue(gid, collisionListMap); - block->CollisionListMaps.emplace(gid, std::move(collisionListMap)); + if (!cp.incoming(gid).empty()) + { + std::unordered_map<vtkIdType, std::set<vtkIdType>> collisionListMap; + cp.dequeue(gid, collisionListMap); + block->CollisionListMaps.emplace(gid, std::move(collisionListMap)); + } } - } - }); + }); vtkLogEndScope("send back detected overlaps"); vtkLogStartScope(TRACE, "add detected overlaps from other ranks"); diff --git a/Filters/ParallelDIY2/vtkPResampleWithDataSet.cxx b/Filters/ParallelDIY2/vtkPResampleWithDataSet.cxx index 81aeb2baf80..2bdf15e3632 100644 --- a/Filters/ParallelDIY2/vtkPResampleWithDataSet.cxx +++ b/Filters/ParallelDIY2/vtkPResampleWithDataSet.cxx @@ -1165,14 +1165,12 @@ int vtkPResampleWithDataSet::RequestData( block.PointsLookup = nullptr; master.exchange(); // perform resampling on local and remote points - master.foreach ([&](DiyBlock* block_, const diy::Master::ProxyWithLink& cp) { - PerformResampling(block_, cp, this->Prober.GetPointer()); - }); + master.foreach ([&](DiyBlock* block_, const diy::Master::ProxyWithLink& cp) + { PerformResampling(block_, cp, this->Prober.GetPointer()); }); master.exchange(); // receive resampled points and set the values in output - master.foreach ([&](DiyBlock* block_, const diy::Master::ProxyWithLink& cp) { - ReceiveResampledPoints(block_, cp, this->Prober->GetValidPointMaskArrayName()); - }); + master.foreach ([&](DiyBlock* block_, const diy::Master::ProxyWithLink& cp) + { ReceiveResampledPoints(block_, cp, this->Prober->GetValidPointMaskArrayName()); }); if (this->MarkBlankPointsAndCells) { diff --git a/Filters/ParallelDIY2/vtkProbeLineFilter.cxx b/Filters/ParallelDIY2/vtkProbeLineFilter.cxx index f4fc90deeab..106f6099bbb 100644 --- a/Filters/ParallelDIY2/vtkProbeLineFilter.cxx +++ b/Filters/ParallelDIY2/vtkProbeLineFilter.cxx @@ -86,12 +86,14 @@ void FillDefaultValues(vtkAbstractArray* array, double defaultValue = 0.0) { if (auto* strArray = vtkStringArray::SafeDownCast(array)) { - vtkSMPTools::For(0, strArray->GetNumberOfValues(), [strArray](vtkIdType start, vtkIdType end) { - for (vtkIdType i = start; i < end; ++i) + vtkSMPTools::For(0, strArray->GetNumberOfValues(), + [strArray](vtkIdType start, vtkIdType end) { - strArray->SetValue(i, ""); - } - }); + for (vtkIdType i = start; i < end; ++i) + { + strArray->SetValue(i, ""); + } + }); } else if (auto* doubleArray = vtkDoubleArray::SafeDownCast(array)) { @@ -113,17 +115,19 @@ vtkSmartPointer<vtkDoubleArray> CreatePoints( auto arclengthArray = vtkSmartPointer<vtkDoubleArray>::New(); arclengthArray->SetName("arc_length"); arclengthArray->SetNumberOfValues(linePoints->GetNumberOfPoints()); - vtkSMPTools::For(0, intersections.size(), [&](vtkIdType begin, vtkIdType end) { - for (vtkIdType i = begin; i < end; ++i) + vtkSMPTools::For(0, intersections.size(), + [&](vtkIdType begin, vtkIdType end) { - const auto& inter = intersections[i]; - linePoints->SetPoint(i * 2, inter.InPos.data()); - arclengthArray->SetValue(i * 2, inter.InT * lengthFactor); + for (vtkIdType i = begin; i < end; ++i) + { + const auto& inter = intersections[i]; + linePoints->SetPoint(i * 2, inter.InPos.data()); + arclengthArray->SetValue(i * 2, inter.InT * lengthFactor); - linePoints->SetPoint(i * 2 + 1, inter.OutPos.data()); - arclengthArray->SetValue(i * 2 + 1, inter.OutT * lengthFactor); - } - }); + linePoints->SetPoint(i * 2 + 1, inter.OutPos.data()); + arclengthArray->SetValue(i * 2 + 1, inter.OutT * lengthFactor); + } + }); return arclengthArray; } @@ -150,14 +154,16 @@ void AddCellData(const std::vector<HitCellInfo>& intersections, vtkCellData* inp vtkAbstractArray* sourceArray = inputCellAttribute->GetAbstractArray(i); if (auto targetArray = ::AddAttribute(sourceArray, resultPointData, npts)) { - vtkSMPTools::For(0, intersections.size(), [&](vtkIdType begin, vtkIdType end) { - for (vtkIdType j = begin; j < end; ++j) + vtkSMPTools::For(0, intersections.size(), + [&](vtkIdType begin, vtkIdType end) { - const auto& inter = intersections[j]; - targetArray->SetTuple(j * 2, inter.CellId, sourceArray); - targetArray->SetTuple(j * 2 + 1, inter.CellId, sourceArray); - } - }); + for (vtkIdType j = begin; j < end; ++j) + { + const auto& inter = intersections[j]; + targetArray->SetTuple(j * 2, inter.CellId, sourceArray); + targetArray->SetTuple(j * 2 + 1, inter.CellId, sourceArray); + } + }); } } } @@ -450,47 +456,50 @@ protected: arclength->SetValue(idx + 1, std::sqrt(vtkMath::Distance2BetweenPoints(this->P1.GetData(), this->P2.GetData()))); } - vtkSMPTools::For(startFor, endFor, [&](vtkIdType start, vtkIdType end) { - for (vtkIdType pt = start; pt < end; ++pt) + vtkSMPTools::For(startFor, endFor, + [&](vtkIdType start, vtkIdType end) { - const vtkIdType idx = pt * 2; - const auto& mergeInfo = mergedInputIndices[pt]; - if (mergeInfo.DsIndex < 0) + for (vtkIdType pt = start; pt < end; ++pt) { - const auto& previousInfo = mergedInputIndices[pt - 1]; - const auto& nextInfo = mergedInputIndices[pt + 1]; - double tmpPnt[3]; - inputs[previousInfo.DsIndex]->GetPoint(previousInfo.PtIndex + 1, tmpPnt); - outputPoints->SetPoint(idx, tmpPnt); - inputs[nextInfo.DsIndex]->GetPoint(nextInfo.PtIndex, tmpPnt); - outputPoints->SetPoint(idx + 1, tmpPnt); - validPointMask->SetValue(idx, 0); - validPointMask->SetValue(idx + 1, 0); - arclength->SetValue( - idx, lengthArrays[previousInfo.DsIndex]->GetValue(previousInfo.PtIndex + 1)); - arclength->SetValue(idx + 1, lengthArrays[nextInfo.DsIndex]->GetValue(nextInfo.PtIndex)); - } - else - { - vtkPolyData* ds = inputs[mergeInfo.DsIndex]; - double tmpPnt[3]; - ds->GetPoint(mergeInfo.PtIndex, tmpPnt); - outputPoints->SetPoint(idx, tmpPnt); - ds->GetPoint(mergeInfo.PtIndex + 1, tmpPnt); - outputPoints->SetPoint(idx + 1, tmpPnt); - vtkDoubleArray* lengths = lengthArrays[mergeInfo.DsIndex]; - arclength->SetValue(idx, lengths->GetValue(mergeInfo.PtIndex)); - arclength->SetValue(idx + 1, lengths->GetValue(mergeInfo.PtIndex + 1)); - for (int i = 0; i < outputPD->GetNumberOfArrays(); ++i) + const vtkIdType idx = pt * 2; + const auto& mergeInfo = mergedInputIndices[pt]; + if (mergeInfo.DsIndex < 0) + { + const auto& previousInfo = mergedInputIndices[pt - 1]; + const auto& nextInfo = mergedInputIndices[pt + 1]; + double tmpPnt[3]; + inputs[previousInfo.DsIndex]->GetPoint(previousInfo.PtIndex + 1, tmpPnt); + outputPoints->SetPoint(idx, tmpPnt); + inputs[nextInfo.DsIndex]->GetPoint(nextInfo.PtIndex, tmpPnt); + outputPoints->SetPoint(idx + 1, tmpPnt); + validPointMask->SetValue(idx, 0); + validPointMask->SetValue(idx + 1, 0); + arclength->SetValue( + idx, lengthArrays[previousInfo.DsIndex]->GetValue(previousInfo.PtIndex + 1)); + arclength->SetValue( + idx + 1, lengthArrays[nextInfo.DsIndex]->GetValue(nextInfo.PtIndex)); + } + else { - auto* targetArray = outputPD->GetAbstractArray(i); - auto* sourceArray = ds->GetPointData()->GetAbstractArray(targetArray->GetName()); - targetArray->SetTuple(idx, mergeInfo.PtIndex, sourceArray); - targetArray->SetTuple(idx + 1, mergeInfo.PtIndex + 1, sourceArray); + vtkPolyData* ds = inputs[mergeInfo.DsIndex]; + double tmpPnt[3]; + ds->GetPoint(mergeInfo.PtIndex, tmpPnt); + outputPoints->SetPoint(idx, tmpPnt); + ds->GetPoint(mergeInfo.PtIndex + 1, tmpPnt); + outputPoints->SetPoint(idx + 1, tmpPnt); + vtkDoubleArray* lengths = lengthArrays[mergeInfo.DsIndex]; + arclength->SetValue(idx, lengths->GetValue(mergeInfo.PtIndex)); + arclength->SetValue(idx + 1, lengths->GetValue(mergeInfo.PtIndex + 1)); + for (int i = 0; i < outputPD->GetNumberOfArrays(); ++i) + { + auto* targetArray = outputPD->GetAbstractArray(i); + auto* sourceArray = ds->GetPointData()->GetAbstractArray(targetArray->GetName()); + targetArray->SetTuple(idx, mergeInfo.PtIndex, sourceArray); + targetArray->SetTuple(idx + 1, mergeInfo.PtIndex + 1, sourceArray); + } } } - } - }); + }); } void MergeSegmentCenters(const std::vector<vtkPolyData*>& inputs, @@ -552,52 +561,54 @@ protected: targetArray->SetTuple(endFor + 1, mergeInfo.PtIndex + 1, sourceArray); } } - vtkSMPTools::For(startFor, endFor, [&](vtkIdType start, vtkIdType end) { - vtkNew<vtkIdList> interpList; - interpList->SetNumberOfIds(2); - for (vtkIdType pt = start; pt < end; ++pt) + vtkSMPTools::For(startFor, endFor, + [&](vtkIdType start, vtkIdType end) { - const vtkIdType idx = pt + 1; - const auto& mergeInfo = mergedInputIndices[pt]; - if (mergeInfo.DsIndex < 0) + vtkNew<vtkIdList> interpList; + interpList->SetNumberOfIds(2); + for (vtkIdType pt = start; pt < end; ++pt) { - const auto& previousInfo = mergedInputIndices[pt - 1]; - const auto& nextInfo = mergedInputIndices[pt + 1]; - vtkVector3d pnt1, pnt2; - inputs[previousInfo.DsIndex]->GetPoint(previousInfo.PtIndex + 1, pnt1.GetData()); - inputs[nextInfo.DsIndex]->GetPoint(nextInfo.PtIndex, pnt2.GetData()); - pnt1 = (pnt1 + pnt2) * 0.5; - outputPoints->SetPoint(idx, pnt1.GetData()); - validPointMask->SetValue(idx, 0); - double length = lengthArrays[previousInfo.DsIndex]->GetValue(previousInfo.PtIndex + 1) + - lengthArrays[nextInfo.DsIndex]->GetValue(previousInfo.PtIndex); - arclength->SetValue(idx, length * 0.5); - } - else - { - vtkPolyData* ds = inputs[mergeInfo.DsIndex]; - vtkVector3d pnt1, pnt2; - ds->GetPoint(mergeInfo.PtIndex, pnt1.GetData()); - ds->GetPoint(mergeInfo.PtIndex + 1, pnt2.GetData()); - pnt1 = (pnt1 + pnt2) * 0.5; - outputPoints->SetPoint(idx, pnt1.GetData()); - - vtkDoubleArray* lengths = lengthArrays[mergeInfo.DsIndex]; - double length = - lengths->GetValue(mergeInfo.PtIndex) + lengths->GetValue(mergeInfo.PtIndex + 1); - arclength->SetValue(idx, length * 0.5); - for (int i = 0; i < outputPD->GetNumberOfArrays(); ++i) + const vtkIdType idx = pt + 1; + const auto& mergeInfo = mergedInputIndices[pt]; + if (mergeInfo.DsIndex < 0) + { + const auto& previousInfo = mergedInputIndices[pt - 1]; + const auto& nextInfo = mergedInputIndices[pt + 1]; + vtkVector3d pnt1, pnt2; + inputs[previousInfo.DsIndex]->GetPoint(previousInfo.PtIndex + 1, pnt1.GetData()); + inputs[nextInfo.DsIndex]->GetPoint(nextInfo.PtIndex, pnt2.GetData()); + pnt1 = (pnt1 + pnt2) * 0.5; + outputPoints->SetPoint(idx, pnt1.GetData()); + validPointMask->SetValue(idx, 0); + double length = lengthArrays[previousInfo.DsIndex]->GetValue(previousInfo.PtIndex + 1) + + lengthArrays[nextInfo.DsIndex]->GetValue(previousInfo.PtIndex); + arclength->SetValue(idx, length * 0.5); + } + else { - auto* targetArray = outputPD->GetAbstractArray(i); - auto* sourceArray = ds->GetPointData()->GetAbstractArray(targetArray->GetName()); - interpList->SetId(0, mergeInfo.PtIndex); - interpList->SetId(1, mergeInfo.PtIndex + 1); - double weights[2] = { 0.5, 0.5 }; - targetArray->InterpolateTuple(idx, interpList, sourceArray, weights); + vtkPolyData* ds = inputs[mergeInfo.DsIndex]; + vtkVector3d pnt1, pnt2; + ds->GetPoint(mergeInfo.PtIndex, pnt1.GetData()); + ds->GetPoint(mergeInfo.PtIndex + 1, pnt2.GetData()); + pnt1 = (pnt1 + pnt2) * 0.5; + outputPoints->SetPoint(idx, pnt1.GetData()); + + vtkDoubleArray* lengths = lengthArrays[mergeInfo.DsIndex]; + double length = + lengths->GetValue(mergeInfo.PtIndex) + lengths->GetValue(mergeInfo.PtIndex + 1); + arclength->SetValue(idx, length * 0.5); + for (int i = 0; i < outputPD->GetNumberOfArrays(); ++i) + { + auto* targetArray = outputPD->GetAbstractArray(i); + auto* sourceArray = ds->GetPointData()->GetAbstractArray(targetArray->GetName()); + interpList->SetId(0, mergeInfo.PtIndex); + interpList->SetId(1, mergeInfo.PtIndex + 1); + double weights[2] = { 0.5, 0.5 }; + targetArray->InterpolateTuple(idx, interpList, sourceArray, weights); + } } } - } - }); + }); } }; vtkStandardNewMacro(vtkRemoteProbeLineMerger); diff --git a/Filters/ParallelDIY2/vtkRedistributeDataSetFilter.cxx b/Filters/ParallelDIY2/vtkRedistributeDataSetFilter.cxx index 1f344898e5a..ed469b1f87c 100644 --- a/Filters/ParallelDIY2/vtkRedistributeDataSetFilter.cxx +++ b/Filters/ParallelDIY2/vtkRedistributeDataSetFilter.cxx @@ -520,12 +520,14 @@ int vtkRedistributeDataSetFilter::RequestData( if (vtkUnsignedCharArray* ghostArray = ds->GetPointData()->GetGhostArray()) { auto ghosts = vtk::DataArrayValueRange<1>(ghostArray); - vtkSMPTools::For(0, ghosts.size(), [&](vtkIdType begin, vtkIdType end) { - for (vtkIdType id = begin; id < end; ++id) + vtkSMPTools::For(0, ghosts.size(), + [&](vtkIdType begin, vtkIdType end) { - ghosts[id] &= ~vtkDataSetAttributes::DUPLICATEPOINT; - } - }); + for (vtkIdType id = begin; id < end; ++id) + { + ghosts[id] &= ~vtkDataSetAttributes::DUPLICATEPOINT; + } + }); }; } @@ -1077,23 +1079,25 @@ void vtkRedistributeDataSetFilter::MarkGhostCells(vtkPartitionedDataSet* pieces) ghostCells->FastDelete(); } - vtkSMPTools::For(0, dataset->GetNumberOfCells(), [&](vtkIdType start, vtkIdType end) { - for (vtkIdType cc = start; cc < end; ++cc) + vtkSMPTools::For(0, dataset->GetNumberOfCells(), + [&](vtkIdType start, vtkIdType end) { - // any cell now owned by the current part is marked as a ghost cell. - const auto cell_owner = cell_ownership->GetTypedComponent(cc, 0); - auto gflag = ghostCells->GetTypedComponent(cc, 0); - if (static_cast<int>(partId) == cell_owner) - { - gflag &= (~vtkDataSetAttributes::DUPLICATECELL); - } - else + for (vtkIdType cc = start; cc < end; ++cc) { - gflag |= vtkDataSetAttributes::DUPLICATECELL; + // any cell now owned by the current part is marked as a ghost cell. + const auto cell_owner = cell_ownership->GetTypedComponent(cc, 0); + auto gflag = ghostCells->GetTypedComponent(cc, 0); + if (static_cast<int>(partId) == cell_owner) + { + gflag &= (~vtkDataSetAttributes::DUPLICATECELL); + } + else + { + gflag |= vtkDataSetAttributes::DUPLICATECELL; + } + ghostCells->SetTypedComponent(cc, 0, gflag); } - ghostCells->SetTypedComponent(cc, 0, gflag); - } - }); + }); } } diff --git a/Filters/ParallelDIY2/vtkStitchImageDataWithGhosts.cxx b/Filters/ParallelDIY2/vtkStitchImageDataWithGhosts.cxx index 456974bb7e9..7fd03a10389 100644 --- a/Filters/ParallelDIY2/vtkStitchImageDataWithGhosts.cxx +++ b/Filters/ParallelDIY2/vtkStitchImageDataWithGhosts.cxx @@ -50,7 +50,8 @@ int vtkStitchImageDataWithGhosts::RequestData( auto dualInputDO = vtkSmartPointer<vtkDataObject>::Take(inputDO->NewInstance()); dualInputDO->ShallowCopy(inputDO); - auto extractImageData = [](vtkDataObject* dObj) { + auto extractImageData = [](vtkDataObject* dObj) + { if (auto cds = vtkCompositeDataSet::SafeDownCast(dObj)) { return vtkCompositeDataSet::GetDataSets<vtkImageData>(cds); diff --git a/Filters/ParallelFlowPaths/vtkPStreamTracer.cxx b/Filters/ParallelFlowPaths/vtkPStreamTracer.cxx index a676b0fd2af..0869617f20c 100644 --- a/Filters/ParallelFlowPaths/vtkPStreamTracer.cxx +++ b/Filters/ParallelFlowPaths/vtkPStreamTracer.cxx @@ -101,7 +101,7 @@ assert(false); \ } \ } -//#define PRINT(id, x) +// #define PRINT(id, x) #else #define PRINT(x) #define ALLPRINT(x) @@ -1643,7 +1643,8 @@ int vtkPStreamTracer::RequestData( if (auto seedIds = vtkIntArray::SafeDownCast(output->GetCellData()->GetArray("SeedIds"))) { vtkSMPTools::For(0, seedIds->GetNumberOfTuples(), - [&originalSeedIds, &seedIds](vtkIdType start, vtkIdType end) { + [&originalSeedIds, &seedIds](vtkIdType start, vtkIdType end) + { for (vtkIdType cc = start; cc < end; ++cc) { const auto seedIdx = seedIds->GetTypedComponent(cc, 0); diff --git a/Filters/ParallelMPI/Testing/Cxx/TestImplicitConnectivity.cxx b/Filters/ParallelMPI/Testing/Cxx/TestImplicitConnectivity.cxx index 4984779621b..24bb0813099 100644 --- a/Filters/ParallelMPI/Testing/Cxx/TestImplicitConnectivity.cxx +++ b/Filters/ParallelMPI/Testing/Cxx/TestImplicitConnectivity.cxx @@ -247,16 +247,16 @@ vtkMultiBlockDataSet* GetRectGridDataSet( vtkRectilinearGrid* wholeGrid = vtkRectilinearGrid::New(); GenerateRectGrid(wholeGrid, wholeExtent, origin); - //#ifdef DEBUG_ON - // if( Controller->GetLocalProcessId() == 0 ) - // { - // vtkRectilinearGridWriter* writer = vtkRectilinearGridWriter::New(); - // writer->SetFileName("RectilinearGrid.vtk"); - // writer->SetInputData( wholeGrid ); - // writer->Write(); - // writer->Delete(); - // } - //#endif + // #ifdef DEBUG_ON + // if( Controller->GetLocalProcessId() == 0 ) + // { + // vtkRectilinearGridWriter* writer = vtkRectilinearGridWriter::New(); + // writer->SetFileName("RectilinearGrid.vtk"); + // writer->SetInputData( wholeGrid ); + // writer->Write(); + // writer->Delete(); + // } + // #endif vtkRectilinearGridPartitioner* gridPartitioner = vtkRectilinearGridPartitioner::New(); gridPartitioner->SetInputData(wholeGrid); gridPartitioner->SetNumberOfPartitions(numPartitions); diff --git a/Filters/Points/vtkMaskPointsFilter.cxx b/Filters/Points/vtkMaskPointsFilter.cxx index 711bb7ca084..d963c031f0a 100644 --- a/Filters/Points/vtkMaskPointsFilter.cxx +++ b/Filters/Points/vtkMaskPointsFilter.cxx @@ -44,35 +44,37 @@ struct ExtractPoints const vtkIdType zD = dims[2]; const vtkIdType xyD = dims[0] * dims[1]; - vtkSMPTools::For(0, numPts, [&](vtkIdType ptId, vtkIdType endPtId) { - const auto pts = vtk::DataArrayTupleRange<3>(ptArray, ptId, endPtId); - using PtCRefT = typename decltype(pts)::ConstTupleReferenceType; - - vtkIdType* map = pointMap + ptId; - - // MSVC 2015 x64 ICEs when this loop is written using std::transform, - // so we'll work around that by using a for-range loop: - for (PtCRefT pt : pts) + vtkSMPTools::For(0, numPts, + [&](vtkIdType ptId, vtkIdType endPtId) { - const int i = static_cast<int>(((pt[0] - bX) * fX)); - const int j = static_cast<int>(((pt[1] - bY) * fY)); - const int k = static_cast<int>(((pt[2] - bZ) * fZ)); + const auto pts = vtk::DataArrayTupleRange<3>(ptArray, ptId, endPtId); + using PtCRefT = typename decltype(pts)::ConstTupleReferenceType; - // If not inside image then skip - if (i < 0 || i >= xD || j < 0 || j >= yD || k < 0 || k >= zD) - { - *map++ = -1; - } - else if (mask[i + j * xD + k * xyD] != emptyValue) - { - *map++ = 1; - } - else + vtkIdType* map = pointMap + ptId; + + // MSVC 2015 x64 ICEs when this loop is written using std::transform, + // so we'll work around that by using a for-range loop: + for (PtCRefT pt : pts) { - *map++ = -1; + const int i = static_cast<int>(((pt[0] - bX) * fX)); + const int j = static_cast<int>(((pt[1] - bY) * fY)); + const int k = static_cast<int>(((pt[2] - bZ) * fZ)); + + // If not inside image then skip + if (i < 0 || i >= xD || j < 0 || j >= yD || k < 0 || k >= zD) + { + *map++ = -1; + } + else if (mask[i + j * xD + k * xyD] != emptyValue) + { + *map++ = 1; + } + else + { + *map++ = -1; + } } - } - }); + }); } }; // ExtractPoints diff --git a/Filters/Points/vtkPointCloudFilter.cxx b/Filters/Points/vtkPointCloudFilter.cxx index 0fe418a10a3..e7c8051d4ed 100644 --- a/Filters/Points/vtkPointCloudFilter.cxx +++ b/Filters/Points/vtkPointCloudFilter.cxx @@ -39,17 +39,19 @@ struct MapPoints ArrayList arrays; arrays.AddArrays(outPts.size(), inPD, outPD, 0.0, false); - vtkSMPTools::For(0, inPts.size(), [&](vtkIdType ptId, vtkIdType endPtId) { - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, inPts.size(), + [&](vtkIdType ptId, vtkIdType endPtId) { - const vtkIdType outPtId = map[ptId]; - if (outPtId != -1) + for (; ptId < endPtId; ++ptId) { - outPts[outPtId] = inPts[ptId]; - arrays.Copy(ptId, outPtId); + const vtkIdType outPtId = map[ptId]; + if (outPtId != -1) + { + outPts[outPtId] = inPts[ptId]; + arrays.Copy(ptId, outPtId); + } } - } - }); + }); } }; @@ -68,18 +70,20 @@ struct MapOutliers ArrayList arrays; arrays.AddArrays(outPts.size(), inPD, outPD, 0.0, false); - vtkSMPTools::For(0, inPts.size(), [&](vtkIdType ptId, vtkIdType endPtId) { - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, inPts.size(), + [&](vtkIdType ptId, vtkIdType endPtId) { - vtkIdType outPtId = map[ptId]; - if (outPtId < 0) + for (; ptId < endPtId; ++ptId) { - outPtId = (-outPtId) - 1; - outPts[outPtId] = inPts[ptId]; - arrays.Copy(ptId, outPtId); + vtkIdType outPtId = map[ptId]; + if (outPtId < 0) + { + outPtId = (-outPtId) - 1; + outPts[outPtId] = inPts[ptId]; + arrays.Copy(ptId, outPtId); + } } - } - }); + }); } }; // MapOutliers diff --git a/Filters/Points/vtkProjectPointsToPlane.cxx b/Filters/Points/vtkProjectPointsToPlane.cxx index 779dd67aef4..4e200762b68 100644 --- a/Filters/Points/vtkProjectPointsToPlane.cxx +++ b/Filters/Points/vtkProjectPointsToPlane.cxx @@ -38,17 +38,19 @@ struct ProjectToCoordinatePlaneWorker const auto ipts = vtk::DataArrayTupleRange<3>(in); auto opts = vtk::DataArrayTupleRange<3>(out); - vtkSMPTools::For(0, numPts, [&](vtkIdType ptId, vtkIdType endPtId) { - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, numPts, + [&](vtkIdType ptId, vtkIdType endPtId) { - const auto xi = ipts[ptId]; - auto xo = opts[ptId]; - - xo[idx[0]] = xi[idx[0]]; - xo[idx[1]] = xi[idx[1]]; - xo[idx[2]] = pc; - } - }); // lambda + for (; ptId < endPtId; ++ptId) + { + const auto xi = ipts[ptId]; + auto xo = opts[ptId]; + + xo[idx[0]] = xi[idx[0]]; + xo[idx[1]] = xi[idx[1]]; + xo[idx[2]] = pc; + } + }); // lambda } }; @@ -80,24 +82,26 @@ struct ProjectToPlaneWorker const auto ipts = vtk::DataArrayTupleRange<3>(in); auto opts = vtk::DataArrayTupleRange<3>(out); - vtkSMPTools::For(0, numPts, [&](vtkIdType ptId, vtkIdType endPtId) { - double x[3], xProj[3]; - for (; ptId < endPtId; ++ptId) + vtkSMPTools::For(0, numPts, + [&](vtkIdType ptId, vtkIdType endPtId) { - const auto xi = ipts[ptId]; - auto xo = opts[ptId]; - - x[0] = xi[0]; - x[1] = xi[1]; - x[2] = xi[2]; - - vtkPlane::ProjectPoint(x, o, n, xProj); - - xo[0] = xProj[0]; - xo[1] = xProj[1]; - xo[2] = xProj[2]; - } - }); // lambda + double x[3], xProj[3]; + for (; ptId < endPtId; ++ptId) + { + const auto xi = ipts[ptId]; + auto xo = opts[ptId]; + + x[0] = xi[0]; + x[1] = xi[1]; + x[2] = xi[2]; + + vtkPlane::ProjectPoint(x, o, n, xProj); + + xo[0] = xProj[0]; + xo[1] = xProj[1]; + xo[2] = xProj[2]; + } + }); // lambda } }; diff --git a/Filters/Reduction/vtkToImplicitRamerDouglasPeuckerStrategy.cxx b/Filters/Reduction/vtkToImplicitRamerDouglasPeuckerStrategy.cxx index d605e02d32b..8fec7db46f0 100644 --- a/Filters/Reduction/vtkToImplicitRamerDouglasPeuckerStrategy.cxx +++ b/Filters/Reduction/vtkToImplicitRamerDouglasPeuckerStrategy.cxx @@ -53,9 +53,8 @@ struct RDPAlgorithm { auto slope = (*end - *begin) / std::distance(begin, end); // for computing the distance between the affine representation and the actual value - auto distance = [&](const Iterator& it) { - return std::abs(static_cast<double>(slope * std::distance(begin, it) + *begin - *it)); - }; + auto distance = [&](const Iterator& it) + { return std::abs(static_cast<double>(slope * std::distance(begin, it) + *begin - *it)); }; // compute max distance loop for (Iterator it = begin + 1; it != end; ++it) { @@ -91,7 +90,8 @@ struct GenerateFunctionalRepresentation { using VType = vtk::GetAPIType<ArrayT>; - auto makeConstant = [](VType val, vtkIdType diff) { + auto makeConstant = [](VType val, vtkIdType diff) + { vtkNew<vtkConstantArray<VType>> constant; constant->SetBackend(std::make_shared<vtkConstantImplicitBackend<VType>>(val)); constant->SetNumberOfComponents(1); diff --git a/Filters/SMP/vtkSMPMergePolyDataHelper.cxx b/Filters/SMP/vtkSMPMergePolyDataHelper.cxx index c869a8c48fd..311e27f635b 100644 --- a/Filters/SMP/vtkSMPMergePolyDataHelper.cxx +++ b/Filters/SMP/vtkSMPMergePolyDataHelper.cxx @@ -201,16 +201,14 @@ public: // Copy the offsets, adding outConnOffset to adjust for existing // connectivity entries: - std::transform( - inCell.cbegin(), inCell.cend(), outCell.begin(), [&](InIndexType i) -> OutIndexType { - return static_cast<OutIndexType>(i + outConnOffset); - }); + std::transform(inCell.cbegin(), inCell.cend(), outCell.begin(), + [&](InIndexType i) -> OutIndexType + { return static_cast<OutIndexType>(i + outConnOffset); }); // Copy the connectivities, passing them through the map: - std::transform( - inConn.cbegin(), inConn.cend(), outConn.begin(), [&](InIndexType i) -> OutIndexType { - return static_cast<OutIndexType>(map->GetId(static_cast<vtkIdType>(i))); - }); + std::transform(inConn.cbegin(), inConn.cend(), outConn.begin(), + [&](InIndexType i) -> OutIndexType + { return static_cast<OutIndexType>(map->GetId(static_cast<vtkIdType>(i))); }); } }; diff --git a/Filters/Sources/vtkHyperTreeGridPreConfiguredSource.cxx b/Filters/Sources/vtkHyperTreeGridPreConfiguredSource.cxx index 118edd526f6..debf17a9b41 100644 --- a/Filters/Sources/vtkHyperTreeGridPreConfiguredSource.cxx +++ b/Filters/Sources/vtkHyperTreeGridPreConfiguredSource.cxx @@ -277,8 +277,8 @@ void vtkHyperTreeGridPreConfiguredSource::Preprocess(vtkHyperTreeGrid* htg, unsi htg->SetDimensions(subdivisions3d.data()); htg->SetBranchFactor(factor); - auto fillArray = []( - vtkDoubleArray* array, vtkIdType numPoints, double minBound, double maxBound) { + auto fillArray = [](vtkDoubleArray* array, vtkIdType numPoints, double minBound, double maxBound) + { array->SetNumberOfComponents(1); array->SetNumberOfTuples(numPoints); double step = (maxBound - minBound) / static_cast<double>(numPoints - 1); diff --git a/Filters/Sources/vtkPartitionedDataSetCollectionSource.cxx b/Filters/Sources/vtkPartitionedDataSetCollectionSource.cxx index ced00767650..6e6c7f00593 100644 --- a/Filters/Sources/vtkPartitionedDataSetCollectionSource.cxx +++ b/Filters/Sources/vtkPartitionedDataSetCollectionSource.cxx @@ -71,17 +71,19 @@ void OffsetPoints(ArrayType* array, const vtkVector3d& delta) using ValueType = vtk::GetAPIType<ArrayType>; - vtkSMPTools::For(0, array->GetNumberOfTuples(), [&](vtkIdType start, vtkIdType end) { - ValueType tuple[3]; - for (vtkIdType tidx = start; tidx < end; ++tidx) + vtkSMPTools::For(0, array->GetNumberOfTuples(), + [&](vtkIdType start, vtkIdType end) { - array->GetTypedTuple(tidx, tuple); - tuple[0] += delta[0]; - tuple[1] += delta[1]; - tuple[2] += delta[2]; - array->SetTypedTuple(tidx, tuple); - } - }); + ValueType tuple[3]; + for (vtkIdType tidx = start; tidx < end; ++tidx) + { + array->GetTypedTuple(tidx, tuple); + tuple[0] += delta[0]; + tuple[1] += delta[1]; + tuple[2] += delta[2]; + array->SetTypedTuple(tidx, tuple); + } + }); } } diff --git a/Filters/Sources/vtkRandomHyperTreeGridSource.cxx b/Filters/Sources/vtkRandomHyperTreeGridSource.cxx index ef286a7489f..0186da98e0f 100644 --- a/Filters/Sources/vtkRandomHyperTreeGridSource.cxx +++ b/Filters/Sources/vtkRandomHyperTreeGridSource.cxx @@ -132,8 +132,8 @@ int vtkRandomHyperTreeGridSource::RequestData( } // Create dataset: - auto fillArray = []( - vtkDoubleArray* array, vtkIdType numPoints, double minBound, double maxBound) { + auto fillArray = [](vtkDoubleArray* array, vtkIdType numPoints, double minBound, double maxBound) + { array->SetNumberOfComponents(1); array->SetNumberOfTuples(numPoints); // We differentiate the pathological case at one point from the other cases diff --git a/Filters/Sources/vtkSelectionSource.cxx b/Filters/Sources/vtkSelectionSource.cxx index b250d8c4742..66dfd7eeb18 100644 --- a/Filters/Sources/vtkSelectionSource.cxx +++ b/Filters/Sources/vtkSelectionSource.cxx @@ -155,9 +155,8 @@ void vtkSelectionSource::SetNodeName(unsigned int nodeId, const char* name) return; } if (std::find_if(this->NodesInfo.begin(), this->NodesInfo.end(), - [&safeNodeName](const std::shared_ptr<NodeInformation>& nodeInfo) { - return nodeInfo->Name == safeNodeName; - }) != this->NodesInfo.end()) + [&safeNodeName](const std::shared_ptr<NodeInformation>& nodeInfo) + { return nodeInfo->Name == safeNodeName; }) != this->NodesInfo.end()) { vtkErrorMacro("Node name already exists: " << safeNodeName); return; diff --git a/Filters/Sources/vtkSpatioTemporalHarmonicsSource.cxx b/Filters/Sources/vtkSpatioTemporalHarmonicsSource.cxx index 2faa87ab43a..7df2dd7b20c 100644 --- a/Filters/Sources/vtkSpatioTemporalHarmonicsSource.cxx +++ b/Filters/Sources/vtkSpatioTemporalHarmonicsSource.cxx @@ -100,7 +100,8 @@ void vtkSpatioTemporalHarmonicsSource::ResetTimeStepValues() double timeValue = 0.0; std::for_each(this->Internals->TimeStepValues.begin(), this->Internals->TimeStepValues.end(), - [&timeValue](double& time) { + [&timeValue](double& time) + { time = timeValue; timeValue += VALUE_STEP; }); diff --git a/Filters/Statistics/vtkLengthDistribution.cxx b/Filters/Statistics/vtkLengthDistribution.cxx index 0709485310e..504e72e1c99 100644 --- a/Filters/Statistics/vtkLengthDistribution.cxx +++ b/Filters/Statistics/vtkLengthDistribution.cxx @@ -84,7 +84,8 @@ int vtkLengthDistribution::RequestData( vtkReservoirSampler<vtkIdType> sampler; std::vector<vtkIdType> ids = sampler(numSamples, dataIn->GetNumberOfCells()); vtkSMPTools::For(0, static_cast<vtkIdType>(ids.size()), - [&dataIn, &lengths, &sampler, &ids](vtkIdType begin, vtkIdType end) { + [&dataIn, &lengths, &sampler, &ids](vtkIdType begin, vtkIdType end) + { vtkNew<vtkIdList> points; std::array<vtkVector3d, 2> endpoints; for (vtkIdType ii = begin; ii < end; ++ii) diff --git a/Filters/Temporal/vtkCriticalTime.cxx b/Filters/Temporal/vtkCriticalTime.cxx index 1b0d74a0207..88c9c3c39ae 100644 --- a/Filters/Temporal/vtkCriticalTime.cxx +++ b/Filters/Temporal/vtkCriticalTime.cxx @@ -120,28 +120,30 @@ struct CheckCriticalTimeComp : public CheckCriticalTimeWorker { vtkDataArrayAccessor<ArrayT> inAcc(inArray); - vtkSMPTools::For(0, inArray->GetNumberOfTuples(), [&](vtkIdType begin, vtkIdType end) { - for (vtkIdType tupleIdx = begin; tupleIdx < end; ++tupleIdx) + vtkSMPTools::For(0, inArray->GetNumberOfTuples(), + [&](vtkIdType begin, vtkIdType end) { - if (!std::isnan(outArray->GetValue(tupleIdx))) - { // Critical time already exceeded - continue; - } + for (vtkIdType tupleIdx = begin; tupleIdx < end; ++tupleIdx) + { + if (!std::isnan(outArray->GetValue(tupleIdx))) + { // Critical time already exceeded + continue; + } - if (selectedComponent == inArray->GetNumberOfComponents() && - inArray->GetNumberOfComponents() > 1) - { // Magnitude requested - if ((this->*(this->ThresholdFunction))(this->ComputeMagnitude(inArray, tupleIdx))) + if (selectedComponent == inArray->GetNumberOfComponents() && + inArray->GetNumberOfComponents() > 1) + { // Magnitude requested + if ((this->*(this->ThresholdFunction))(this->ComputeMagnitude(inArray, tupleIdx))) + { + outArray->SetValue(tupleIdx, currentTimeStep); + } + } + else if ((this->*(this->ThresholdFunction))(inAcc.Get(tupleIdx, selectedComponent))) { outArray->SetValue(tupleIdx, currentTimeStep); } } - else if ((this->*(this->ThresholdFunction))(inAcc.Get(tupleIdx, selectedComponent))) - { - outArray->SetValue(tupleIdx, currentTimeStep); - } - } - }); + }); } }; @@ -159,24 +161,26 @@ struct CheckCriticalTimeAny : public CheckCriticalTimeWorker { vtkDataArrayAccessor<ArrayT> inAcc(inArray); - vtkSMPTools::For(0, inArray->GetNumberOfTuples(), [&](vtkIdType begin, vtkIdType end) { - for (vtkIdType tupleIdx = begin; tupleIdx < end; ++tupleIdx) + vtkSMPTools::For(0, inArray->GetNumberOfTuples(), + [&](vtkIdType begin, vtkIdType end) { - if (!std::isnan(outArray->GetValue(tupleIdx))) - { // Critical time already exceeded - continue; - } - - for (int comp = 0; comp < inArray->GetNumberOfComponents(); ++comp) + for (vtkIdType tupleIdx = begin; tupleIdx < end; ++tupleIdx) { - if ((this->*(this->ThresholdFunction))(inAcc.Get(tupleIdx, comp))) + if (!std::isnan(outArray->GetValue(tupleIdx))) + { // Critical time already exceeded + continue; + } + + for (int comp = 0; comp < inArray->GetNumberOfComponents(); ++comp) { - outArray->SetValue(tupleIdx, currentTimeStep); - break; + if ((this->*(this->ThresholdFunction))(inAcc.Get(tupleIdx, comp))) + { + outArray->SetValue(tupleIdx, currentTimeStep); + break; + } } } - } - }); + }); } }; @@ -194,29 +198,31 @@ struct CheckCriticalTimeAll : public CheckCriticalTimeWorker { vtkDataArrayAccessor<ArrayT> inAcc(inArray); - vtkSMPTools::For(0, inArray->GetNumberOfTuples(), [&](vtkIdType begin, vtkIdType end) { - for (vtkIdType tupleIdx = begin; tupleIdx < end; ++tupleIdx) + vtkSMPTools::For(0, inArray->GetNumberOfTuples(), + [&](vtkIdType begin, vtkIdType end) { - if (!std::isnan(outArray->GetValue(tupleIdx))) - { // Critical time already exceeded - continue; - } - - bool allExceed = true; - for (int comp = 0; comp < inArray->GetNumberOfComponents(); ++comp) + for (vtkIdType tupleIdx = begin; tupleIdx < end; ++tupleIdx) { - if (!(this->*(this->ThresholdFunction))(inAcc.Get(tupleIdx, comp))) + if (!std::isnan(outArray->GetValue(tupleIdx))) + { // Critical time already exceeded + continue; + } + + bool allExceed = true; + for (int comp = 0; comp < inArray->GetNumberOfComponents(); ++comp) { - allExceed = false; - break; + if (!(this->*(this->ThresholdFunction))(inAcc.Get(tupleIdx, comp))) + { + allExceed = false; + break; + } + } + if (allExceed) + { + outArray->SetValue(tupleIdx, currentTimeStep); } } - if (allExceed) - { - outArray->SetValue(tupleIdx, currentTimeStep); - } - } - }); + }); } }; } // anonymous namespace diff --git a/Filters/Verdict/vtkBoundaryMeshQuality.cxx b/Filters/Verdict/vtkBoundaryMeshQuality.cxx index fe66812ac17..e0fbab093cb 100644 --- a/Filters/Verdict/vtkBoundaryMeshQuality.cxx +++ b/Filters/Verdict/vtkBoundaryMeshQuality.cxx @@ -216,30 +216,33 @@ int vtkBoundaryMeshQuality::RequestData(vtkInformation* vtkNotUsed(request), distanceFromCellCenterToFaceCenterArray->SetName("DistanceFromCellCenterToFaceCenter"); distanceFromCellCenterToFaceCenterArray->SetNumberOfValues(numberOfOutputCells); - vtkSMPTools::For(0, numberOfOutputCells, [&](vtkIdType begin, vtkIdType end) { - auto distanceArray = vtk::DataArrayValueRange<1>(distanceFromCellCenterToFaceCenterArray); - - bool isFirst = vtkSMPTools::GetSingleThread(); - auto checkAbortInterval = std::min(numberOfOutputCells / 10 + 1, (vtkIdType)1000); - for (vtkIdType cellId = begin; cellId < end; ++cellId) + vtkSMPTools::For(0, numberOfOutputCells, + [&](vtkIdType begin, vtkIdType end) { - if (cellId % checkAbortInterval == 0) + auto distanceArray = vtk::DataArrayValueRange<1>(distanceFromCellCenterToFaceCenterArray); + + bool isFirst = vtkSMPTools::GetSingleThread(); + auto checkAbortInterval = std::min(numberOfOutputCells / 10 + 1, (vtkIdType)1000); + for (vtkIdType cellId = begin; cellId < end; ++cellId) { - if (isFirst) - { - this->CheckAbort(); - } - if (this->GetAbortOutput()) + if (cellId % checkAbortInterval == 0) { - break; + if (isFirst) + { + this->CheckAbort(); + } + if (this->GetAbortOutput()) + { + break; + } } + const auto originalCellId = originalCellIds->GetValue(cellId); + const auto faceCenter = outputCellCenters->GetPointer(3 * cellId); + const auto cellCenter = inputCellCenters->GetPointer(3 * originalCellId); + distanceArray[cellId] = + std::sqrt(vtkMath::Distance2BetweenPoints(faceCenter, cellCenter)); } - const auto originalCellId = originalCellIds->GetValue(cellId); - const auto faceCenter = outputCellCenters->GetPointer(3 * cellId); - const auto cellCenter = inputCellCenters->GetPointer(3 * originalCellId); - distanceArray[cellId] = std::sqrt(vtkMath::Distance2BetweenPoints(faceCenter, cellCenter)); - } - }); + }); output->GetCellData()->AddArray(distanceFromCellCenterToFaceCenterArray); } this->UpdateProgress(0.7); @@ -280,32 +283,34 @@ int vtkBoundaryMeshQuality::RequestData(vtkInformation* vtkNotUsed(request), distanceFromCellCenterToFacePlaneArray->SetName("DistanceFromCellCenterToFacePlane"); distanceFromCellCenterToFacePlaneArray->SetNumberOfValues(numberOfOutputCells); - vtkSMPTools::For(0, numberOfOutputCells, [&](vtkIdType begin, vtkIdType end) { - auto distanceArray = vtk::DataArrayValueRange<1>(distanceFromCellCenterToFacePlaneArray); - double faceNormal[3]; - - bool isFirst = vtkSMPTools::GetSingleThread(); - auto checkAbortInterval = std::min(numberOfOutputCells / 10 + 1, (vtkIdType)1000); - for (vtkIdType cellId = begin; cellId < end; ++cellId) + vtkSMPTools::For(0, numberOfOutputCells, + [&](vtkIdType begin, vtkIdType end) { - if (cellId % checkAbortInterval == 0) + auto distanceArray = vtk::DataArrayValueRange<1>(distanceFromCellCenterToFacePlaneArray); + double faceNormal[3]; + + bool isFirst = vtkSMPTools::GetSingleThread(); + auto checkAbortInterval = std::min(numberOfOutputCells / 10 + 1, (vtkIdType)1000); + for (vtkIdType cellId = begin; cellId < end; ++cellId) { - if (isFirst) + if (cellId % checkAbortInterval == 0) { - this->CheckAbort(); - } - if (this->GetAbortOutput()) - { - break; + if (isFirst) + { + this->CheckAbort(); + } + if (this->GetAbortOutput()) + { + break; + } } + const auto originalCellId = originalCellIds->GetValue(cellId); + outputNormals->GetTuple(cellId, faceNormal); + const auto faceCenter = outputCellCenters->GetPointer(3 * cellId); + const auto cellCenter = inputCellCenters->GetPointer(3 * originalCellId); + distanceArray[cellId] = vtkPlane::DistanceToPlane(faceCenter, faceNormal, cellCenter); } - const auto originalCellId = originalCellIds->GetValue(cellId); - outputNormals->GetTuple(cellId, faceNormal); - const auto faceCenter = outputCellCenters->GetPointer(3 * cellId); - const auto cellCenter = inputCellCenters->GetPointer(3 * originalCellId); - distanceArray[cellId] = vtkPlane::DistanceToPlane(faceCenter, faceNormal, cellCenter); - } - }); + }); output->GetCellData()->AddArray(distanceFromCellCenterToFacePlaneArray); } this->UpdateProgress(0.9); @@ -327,38 +332,40 @@ int vtkBoundaryMeshQuality::RequestData(vtkInformation* vtkNotUsed(request), "AngleFaceNormalAndCellCenterToFaceCenterVector"); angleFaceNormalAndCellCenterToFaceCenterVectorArray->SetNumberOfValues(numberOfOutputCells); - vtkSMPTools::For(0, numberOfOutputCells, [&](vtkIdType begin, vtkIdType end) { - auto angleArray = - vtk::DataArrayValueRange<1>(angleFaceNormalAndCellCenterToFaceCenterVectorArray); - double cellCenterToFaceCenterVector[3]; - double normal[3]; - - bool isFirst = vtkSMPTools::GetSingleThread(); - auto checkAbortInterval = std::min(numberOfOutputCells / 10 + 1, (vtkIdType)1000); - for (vtkIdType cellId = begin; cellId < end; ++cellId) + vtkSMPTools::For(0, numberOfOutputCells, + [&](vtkIdType begin, vtkIdType end) { - if (cellId % checkAbortInterval == 0) + auto angleArray = + vtk::DataArrayValueRange<1>(angleFaceNormalAndCellCenterToFaceCenterVectorArray); + double cellCenterToFaceCenterVector[3]; + double normal[3]; + + bool isFirst = vtkSMPTools::GetSingleThread(); + auto checkAbortInterval = std::min(numberOfOutputCells / 10 + 1, (vtkIdType)1000); + for (vtkIdType cellId = begin; cellId < end; ++cellId) { - if (isFirst) + if (cellId % checkAbortInterval == 0) { - this->CheckAbort(); - } - if (this->GetAbortOutput()) - { - break; + if (isFirst) + { + this->CheckAbort(); + } + if (this->GetAbortOutput()) + { + break; + } } + const auto originalCellId = originalCellIds->GetValue(cellId); + const auto faceCenter = outputCellCenters->GetPointer(3 * cellId); + const auto cellCenter = inputCellCenters->GetPointer(3 * originalCellId); + outputNormals->GetTuple(cellId, normal); + // compute normal from cell center to face center + vtkMath::Subtract(faceCenter, cellCenter, cellCenterToFaceCenterVector); + vtkMath::Normalize(cellCenterToFaceCenterVector); + angleArray[cellId] = vtkMath::DegreesFromRadians( + vtkMath::AngleBetweenVectors(normal, cellCenterToFaceCenterVector)); } - const auto originalCellId = originalCellIds->GetValue(cellId); - const auto faceCenter = outputCellCenters->GetPointer(3 * cellId); - const auto cellCenter = inputCellCenters->GetPointer(3 * originalCellId); - outputNormals->GetTuple(cellId, normal); - // compute normal from cell center to face center - vtkMath::Subtract(faceCenter, cellCenter, cellCenterToFaceCenterVector); - vtkMath::Normalize(cellCenterToFaceCenterVector); - angleArray[cellId] = vtkMath::DegreesFromRadians( - vtkMath::AngleBetweenVectors(normal, cellCenterToFaceCenterVector)); - } - }); + }); output->GetCellData()->AddArray(angleFaceNormalAndCellCenterToFaceCenterVectorArray); } this->UpdateProgress(1.0); diff --git a/GUISupport/Qt/QVTKOpenGLNativeWidget.cxx b/GUISupport/Qt/QVTKOpenGLNativeWidget.cxx index 5ccb2a3e958..13089154675 100644 --- a/GUISupport/Qt/QVTKOpenGLNativeWidget.cxx +++ b/GUISupport/Qt/QVTKOpenGLNativeWidget.cxx @@ -208,8 +208,9 @@ void QVTKOpenGLNativeWidget::initializeGL() if (!this->RenderWindow->GetInitialized()) { - auto loadFunc = [](void* userData, - const char* name) -> vtkOpenGLRenderWindow::VTKOpenGLAPIProc { + auto loadFunc = []( + void* userData, const char* name) -> vtkOpenGLRenderWindow::VTKOpenGLAPIProc + { if (auto* context = reinterpret_cast<QOpenGLContext*>(userData)) { if (auto* symbol = context->getProcAddress(name)) diff --git a/GUISupport/Qt/QVTKOpenGLWindow.cxx b/GUISupport/Qt/QVTKOpenGLWindow.cxx index 167a194b1a2..e34ff815b79 100644 --- a/GUISupport/Qt/QVTKOpenGLWindow.cxx +++ b/GUISupport/Qt/QVTKOpenGLWindow.cxx @@ -194,8 +194,9 @@ void QVTKOpenGLWindow::initializeGL() if (!this->RenderWindow->GetInitialized()) { - auto loadFunc = [](void* userData, - const char* name) -> vtkOpenGLRenderWindow::VTKOpenGLAPIProc { + auto loadFunc = []( + void* userData, const char* name) -> vtkOpenGLRenderWindow::VTKOpenGLAPIProc + { if (auto* context = reinterpret_cast<QOpenGLContext*>(userData)) { if (auto* symbol = context->getProcAddress(name)) diff --git a/GUISupport/Qt/vtkQWidgetTexture.cxx b/GUISupport/Qt/vtkQWidgetTexture.cxx index cc509278c96..e6a83c4299b 100644 --- a/GUISupport/Qt/vtkQWidgetTexture.cxx +++ b/GUISupport/Qt/vtkQWidgetTexture.cxx @@ -35,7 +35,8 @@ vtkQWidgetTexture::vtkQWidgetTexture() this->SetMinificationFilter(vtkTextureObject::LinearMipmapLinear); this->GenerateMipmap = true; - this->RedrawMethod = [this]() { + this->RedrawMethod = [this]() + { if (this->Scene && this->Widget) { if (!this->Context) diff --git a/GUISupport/QtQuick/QQuickVTKItem.cxx b/GUISupport/QtQuick/QQuickVTKItem.cxx index 1f90c9c9ecb..79528bd1274 100644 --- a/GUISupport/QtQuick/QQuickVTKItem.cxx +++ b/GUISupport/QtQuick/QQuickVTKItem.cxx @@ -166,7 +166,8 @@ public: vtkWindow->SetMultiSamples(0); vtkWindow->SetReadyForRendering(false); vtkWindow->SetFrameBlitModeToNoBlit(); - auto loadFunc = [](void*, const char* name) -> vtkOpenGLRenderWindow::VTKOpenGLAPIProc { + auto loadFunc = [](void*, const char* name) -> vtkOpenGLRenderWindow::VTKOpenGLAPIProc + { if (auto context = QOpenGLContext::currentContext()) { if (auto* symbol = context->getProcAddress(name)) @@ -440,27 +441,24 @@ bool QQuickVTKItem::event(QEvent* ev) auto e = static_cast<QHoverEvent*>(ev); auto c = QSharedPointer<QHoverEvent>::create(e->type(), e->posF(), e->oldPosF(), e->modifiers()); - dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable { - d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); - }); + dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable + { d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); }); break; } case QEvent::Enter: { auto e = static_cast<QEnterEvent*>(ev); auto c = QSharedPointer<QEnterEvent>::create(e->localPos(), e->windowPos(), e->screenPos()); - dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable { - d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); - }); + dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable + { d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); }); break; } case QEvent::Leave: { auto e = static_cast<QEvent*>(ev); auto c = QSharedPointer<QEvent>::create(e->type()); - dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable { - d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); - }); + dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable + { d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); }); break; } case QEvent::DragEnter: @@ -468,17 +466,15 @@ bool QQuickVTKItem::event(QEvent* ev) auto e = static_cast<QDragEnterEvent*>(ev); auto c = QSharedPointer<QDragEnterEvent>::create( e->pos(), e->possibleActions(), e->mimeData(), e->mouseButtons(), e->keyboardModifiers()); - dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable { - d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); - }); + dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable + { d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); }); break; } case QEvent::DragLeave: { auto c = QSharedPointer<QDragLeaveEvent>::create(); - dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable { - d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); - }); + dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable + { d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); }); break; } case QEvent::DragMove: @@ -486,9 +482,8 @@ bool QQuickVTKItem::event(QEvent* ev) auto e = static_cast<QDragMoveEvent*>(ev); auto c = QSharedPointer<QDragMoveEvent>::create( e->pos(), e->possibleActions(), e->mimeData(), e->mouseButtons(), e->keyboardModifiers()); - dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable { - d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); - }); + dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable + { d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); }); break; } case QEvent::Drop: @@ -496,9 +491,8 @@ bool QQuickVTKItem::event(QEvent* ev) auto e = static_cast<QDropEvent*>(ev); auto c = QSharedPointer<QDropEvent>::create( e->pos(), e->possibleActions(), e->mimeData(), e->mouseButtons(), e->keyboardModifiers()); - dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable { - d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); - }); + dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable + { d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); }); break; } case QEvent::ContextMenu: @@ -506,9 +500,8 @@ bool QQuickVTKItem::event(QEvent* ev) auto e = static_cast<QContextMenuEvent*>(ev); auto c = QSharedPointer<QContextMenuEvent>::create( e->reason(), e->pos(), e->globalPos(), e->modifiers()); - dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable { - d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); - }); + dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable + { d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); }); break; } case QEvent::KeyPress: @@ -518,9 +511,8 @@ bool QQuickVTKItem::event(QEvent* ev) auto c = QSharedPointer<QKeyEvent>::create(e->type(), e->key(), e->modifiers(), e->nativeScanCode(), e->nativeVirtualKey(), e->nativeModifiers(), e->text(), e->isAutoRepeat(), e->count()); - dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable { - d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); - }); + dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable + { d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); }); break; } case QEvent::FocusIn: @@ -528,9 +520,8 @@ bool QQuickVTKItem::event(QEvent* ev) { auto e = static_cast<QFocusEvent*>(ev); auto c = QSharedPointer<QFocusEvent>::create(e->type(), e->reason()); - dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable { - d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); - }); + dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable + { d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); }); break; } case QEvent::MouseMove: @@ -541,9 +532,8 @@ bool QQuickVTKItem::event(QEvent* ev) auto e = static_cast<QMouseEvent*>(ev); auto c = QSharedPointer<QMouseEvent>::create(e->type(), e->localPos(), e->windowPos(), e->screenPos(), e->button(), e->buttons(), e->modifiers(), e->source()); - dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable { - d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); - }); + dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable + { d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); }); break; } #ifndef QT_NO_WHEELEVENT @@ -562,9 +552,8 @@ bool QQuickVTKItem::event(QEvent* ev) QSharedPointer<QWheelEvent>::create(e->position(), e->globalPosition(), e->pixelDelta(), e->angleDelta(), e->buttons(), e->modifiers(), e->phase(), e->inverted(), e->source()); #endif - dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable { - d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); - }); + dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable + { d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); }); break; } #endif @@ -577,9 +566,8 @@ bool QQuickVTKItem::event(QEvent* ev) auto e = static_cast<QTouchEvent*>(ev); auto c = QSharedPointer<QTouchEvent>::create( e->type(), e->device(), e->modifiers(), e->touchPointStates(), e->touchPoints()); - dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable { - d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); - }); + dispatch_async([d, c](vtkRenderWindow* vtkWindow, vtkUserData) mutable + { d->qt2vtkInteractorAdapter.ProcessEvent(c.data(), vtkWindow->GetInteractor()); }); break; } #endif @@ -588,10 +576,12 @@ bool QQuickVTKItem::event(QEvent* ev) } #else auto e = ev->clone(); - dispatch_async([d, e](vtkRenderWindow* vtkWindow, vtkUserData) mutable { - d->qt2vtkInteractorAdapter.ProcessEvent(e, vtkWindow->GetInteractor()); - delete e; - }); + dispatch_async( + [d, e](vtkRenderWindow* vtkWindow, vtkUserData) mutable + { + d->qt2vtkInteractorAdapter.ProcessEvent(e, vtkWindow->GetInteractor()); + delete e; + }); #endif ev->accept(); diff --git a/GUISupport/QtQuick/QQuickVTKRenderWindow.cxx b/GUISupport/QtQuick/QQuickVTKRenderWindow.cxx index cde0e458684..0f340b13685 100644 --- a/GUISupport/QtQuick/QQuickVTKRenderWindow.cxx +++ b/GUISupport/QtQuick/QQuickVTKRenderWindow.cxx @@ -254,7 +254,8 @@ void QQuickVTKRenderWindow::setRenderWindow(vtkGenericOpenGLRenderWindow* renWin this->m_renderWindow->SetMultiSamples(0); this->m_renderWindow->SetReadyForRendering(false); this->m_renderWindow->SetFrameBlitModeToBlitToHardware(); - auto loadFunc = [](void*, const char* name) -> vtkOpenGLRenderWindow::VTKOpenGLAPIProc { + auto loadFunc = [](void*, const char* name) -> vtkOpenGLRenderWindow::VTKOpenGLAPIProc + { if (auto context = QOpenGLContext::currentContext()) { if (auto* symbol = context->getProcAddress(name)) diff --git a/GUISupport/QtQuick/Testing/Cxx/TestQQuickCommon.cxx b/GUISupport/QtQuick/Testing/Cxx/TestQQuickCommon.cxx index b8eaa0d8e63..42d8cd0b5bf 100644 --- a/GUISupport/QtQuick/Testing/Cxx/TestQQuickCommon.cxx +++ b/GUISupport/QtQuick/Testing/Cxx/TestQQuickCommon.cxx @@ -67,27 +67,35 @@ int performTest(int argc, char* argv[], const char* filename) _updateTimer.setInterval(5); connect(&_updateTimer, &QTimer::timeout, this, [this] { render(); }); - connect(_quickWindow, &QQuickWindow::sceneGraphInitialized, this, [this] { - _fbo = new QOpenGLFramebufferObject( - _quickWindow->size(), QOpenGLFramebufferObject::CombinedDepthStencil); + connect(_quickWindow, &QQuickWindow::sceneGraphInitialized, this, + [this] + { + _fbo = new QOpenGLFramebufferObject( + _quickWindow->size(), QOpenGLFramebufferObject::CombinedDepthStencil); #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - _quickWindow->setRenderTarget(_fbo); + _quickWindow->setRenderTarget(_fbo); #else _quickWindow->setRenderTarget(QQuickRenderTarget::fromOpenGLTexture(_fbo->texture(), _fbo->size())); #endif - }); - connect(_quickWindow, &QQuickWindow::sceneGraphInvalidated, this, [this] { - delete _fbo; - _fbo = nullptr; - }); - connect(_renderControl, &QQuickRenderControl::renderRequested, this, [this] { - if (!_updateTimer.isActive()) - _updateTimer.start(); - }); - connect(_renderControl, &QQuickRenderControl::sceneChanged, this, [this] { - if (!_updateTimer.isActive()) - _updateTimer.start(); - }); + }); + connect(_quickWindow, &QQuickWindow::sceneGraphInvalidated, this, + [this] + { + delete _fbo; + _fbo = nullptr; + }); + connect(_renderControl, &QQuickRenderControl::renderRequested, this, + [this] + { + if (!_updateTimer.isActive()) + _updateTimer.start(); + }); + connect(_renderControl, &QQuickRenderControl::sceneChanged, this, + [this] + { + if (!_updateTimer.isActive()) + _updateTimer.start(); + }); _component = new QQmlComponent(_engine, url); if (_component->isLoading()) @@ -115,7 +123,8 @@ int performTest(int argc, char* argv[], const char* filename) } void run() { - auto reportFailure = [this] { + auto reportFailure = [this] + { if (_component->isError()) { const QList<QQmlError> errorList = _component->errors(); diff --git a/IO/ADIOS2/Testing/Cxx/TestIOADIOS2VTX_VTI3D.cxx b/IO/ADIOS2/Testing/Cxx/TestIOADIOS2VTX_VTI3D.cxx index 698ff884a73..5ee72394028 100644 --- a/IO/ADIOS2/Testing/Cxx/TestIOADIOS2VTX_VTI3D.cxx +++ b/IO/ADIOS2/Testing/Cxx/TestIOADIOS2VTX_VTI3D.cxx @@ -215,7 +215,8 @@ vtkStandardNewMacro(TesterVTI3D); int TestIOADIOS2VTX_VTI3D(int argc, char* argv[]) { - auto lf_DoTest = [&](const std::string& fileName, const size_t steps) { + auto lf_DoTest = [&](const std::string& fileName, const size_t steps) + { vtkNew<vtkADIOS2VTXReader> adios2Reader; adios2Reader->SetFileName(fileName.c_str()); // check FileName diff --git a/IO/ADIOS2/Testing/Cxx/TestIOADIOS2VTX_VTU3D.cxx b/IO/ADIOS2/Testing/Cxx/TestIOADIOS2VTX_VTU3D.cxx index 175be44f24b..4bda2209222 100644 --- a/IO/ADIOS2/Testing/Cxx/TestIOADIOS2VTX_VTU3D.cxx +++ b/IO/ADIOS2/Testing/Cxx/TestIOADIOS2VTX_VTU3D.cxx @@ -308,7 +308,8 @@ void WriteBPFile3DVars(const std::string& fileName, const size_t steps, const in int TestIOADIOS2VTX_VTU3D(int argc, char* argv[]) { - auto lf_DoTest = [&](const std::string& fileName, const size_t steps) { + auto lf_DoTest = [&](const std::string& fileName, const size_t steps) + { vtkNew<vtkADIOS2VTXReader> adios2Reader; adios2Reader->SetFileName(fileName.c_str()); // check FileName diff --git a/IO/ADIOS2/Testing/Cxx/UnitTestIOADIOS2VTX.cxx b/IO/ADIOS2/Testing/Cxx/UnitTestIOADIOS2VTX.cxx index 7a7fef7c933..9d991afaaf8 100644 --- a/IO/ADIOS2/Testing/Cxx/UnitTestIOADIOS2VTX.cxx +++ b/IO/ADIOS2/Testing/Cxx/UnitTestIOADIOS2VTX.cxx @@ -596,7 +596,8 @@ bool TestPointDataTime(const std::string& baseDir) adios2Reader->Update(); - auto checkTimestep = [&](double timestep) { + auto checkTimestep = [&](double timestep) + { adios2Reader->GetOutputInformation(0)->Set( vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP(), timestep); adios2Reader->Update(); @@ -677,13 +678,15 @@ bool TestCellDataTime(const std::string& baseDir) int UnitTestIOADIOS2VTX(int argc, char* argv[]) { - auto lf_GetFileName = [](const size_t id) -> std::string { + auto lf_GetFileName = [](const size_t id) -> std::string + { vtkNew<vtkTesting> testing; const std::string rootDirectory(testing->GetTempDirectory()); return rootDirectory + "/dummy_" + std::to_string(id) + ".bp"; }; - auto lf_TestBadFile = [&](const std::string& fileName, const size_t id) { + auto lf_TestBadFile = [&](const std::string& fileName, const size_t id) + { std::cout << id << " " << fileName << "\n"; vtkNew<vtkADIOS2VTXReader> reader; reader->SetFileName(fileName.c_str()); @@ -752,7 +755,8 @@ int UnitTestIOADIOS2VTX(int argc, char* argv[]) std::string baseDir = vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/ADIOS2/vtx/bp4/"); - auto lf_TestCornerCase = [&](bool (*function)(const std::string&), const char* name) { + auto lf_TestCornerCase = [&](bool (*function)(const std::string&), const char* name) + { ++testID; std::cout << testID << " " << name << "\n"; bool success = function(baseDir); diff --git a/IO/ADIOS2/VTX/schema/VTXSchema.cxx b/IO/ADIOS2/VTX/schema/VTXSchema.cxx index 1d3a60e820b..66d412f42f7 100644 --- a/IO/ADIOS2/VTX/schema/VTXSchema.cxx +++ b/IO/ADIOS2/VTX/schema/VTXSchema.cxx @@ -57,7 +57,10 @@ void VTXSchema::GetTimes(const std::string& variableName) " in Engine " + this->Engine.Name() + " when reading time data\n"); } #define declare_type(T) \ - else if (type == adios2::GetType<T>()) { GetTimesCommon<T>(variableName); } + else if (type == adios2::GetType<T>()) \ + { \ + GetTimesCommon<T>(variableName); \ + } VTK_IO_ADIOS2_VTX_ARRAY_TYPE(declare_type) #undef declare_type } diff --git a/IO/ADIOS2/VTX/schema/vtk/VTXvtkVTI.cxx b/IO/ADIOS2/VTX/schema/vtk/VTXvtkVTI.cxx index 23bf22ae7e9..bda23397f20 100644 --- a/IO/ADIOS2/VTX/schema/vtk/VTXvtkVTI.cxx +++ b/IO/ADIOS2/VTX/schema/vtk/VTXvtkVTI.cxx @@ -96,8 +96,9 @@ void VTXvtkVTI::ReadPiece(size_t step, size_t pieceID) // PRIVATE void VTXvtkVTI::Init() { - auto lf_InitPieceDataSetType = [&](types::Piece& piece, const types::DataSetType type, - const pugi::xml_node& pieceNode) { + auto lf_InitPieceDataSetType = + [&](types::Piece& piece, const types::DataSetType type, const pugi::xml_node& pieceNode) + { const std::string nodeName = DataSetType(type); const pugi::xml_node dataSetNode = helper::XMLNode( nodeName, pieceNode, true, "when reading " + nodeName + " node in ImageData", false); @@ -115,7 +116,8 @@ void VTXvtkVTI::Init() piece[type] = dataSet; }; - auto lf_InitExtent = [&](const pugi::xml_node& extentNode) { + auto lf_InitExtent = [&](const pugi::xml_node& extentNode) + { // Spacing const pugi::xml_attribute spacingXML = vtx::helper::XMLAttribute( "Spacing", extentNode, true, "when reading Spacing in ImageData", true); diff --git a/IO/ADIOS2/VTX/schema/vtk/VTXvtkVTU.cxx b/IO/ADIOS2/VTX/schema/vtk/VTXvtkVTU.cxx index dd8596d3bd1..94b5424c41c 100644 --- a/IO/ADIOS2/VTX/schema/vtk/VTXvtkVTU.cxx +++ b/IO/ADIOS2/VTX/schema/vtk/VTXvtkVTU.cxx @@ -223,8 +223,9 @@ void VTXvtkVTU::ReadPiece(size_t step, size_t pieceID) void VTXvtkVTU::Init() { - auto lf_InitPieceDataSetType = [&](types::Piece& piece, const types::DataSetType type, - const pugi::xml_node& pieceNode) { + auto lf_InitPieceDataSetType = + [&](types::Piece& piece, const types::DataSetType type, const pugi::xml_node& pieceNode) + { const std::string nodeName = DataSetType(type); const pugi::xml_node dataSetNode = helper::XMLNode( nodeName, pieceNode, true, "when reading " + nodeName + " node in ImageData", false); diff --git a/IO/AMR/vtkAMRVelodyneReaderInternal.h b/IO/AMR/vtkAMRVelodyneReaderInternal.h index c8da9eed80f..32886b3b803 100644 --- a/IO/AMR/vtkAMRVelodyneReaderInternal.h +++ b/IO/AMR/vtkAMRVelodyneReaderInternal.h @@ -32,7 +32,7 @@ #define H5_USE_16_API #include "vtk_hdf5.h" -//#include "hdf5.h" +// #include "hdf5.h" //================================================================================ // INTERNAL VELODYNE READER diff --git a/IO/CGNS/vtkCGNSReader.cxx b/IO/CGNS/vtkCGNSReader.cxx index 62da4919e03..ad9626a2208 100644 --- a/IO/CGNS/vtkCGNSReader.cxx +++ b/IO/CGNS/vtkCGNSReader.cxx @@ -2572,10 +2572,9 @@ int vtkCGNSReader::GetUnstructuredZone( // in the same order as in the CGNS file std::vector<std::size_t> indices(elemSec.size()); std::iota(indices.begin(), indices.end(), 0); - std::sort( - indices.begin(), indices.end(), [&elemSec, §ionInfoList](std::size_t a, std::size_t b) { - return sectionInfoList[elemSec[a]].range[0] < sectionInfoList[elemSec[b]].range[0]; - }); + std::sort(indices.begin(), indices.end(), + [&elemSec, §ionInfoList](std::size_t a, std::size_t b) + { return sectionInfoList[elemSec[a]].range[0] < sectionInfoList[elemSec[b]].range[0]; }); std::vector<vtkIdType> startArraySec(elemSec.size()); diff --git a/IO/CGNS/vtkCONVERGECFDCGNSReader.cxx b/IO/CGNS/vtkCONVERGECFDCGNSReader.cxx index 0e05241567a..28d67be67c1 100644 --- a/IO/CGNS/vtkCONVERGECFDCGNSReader.cxx +++ b/IO/CGNS/vtkCONVERGECFDCGNSReader.cxx @@ -50,8 +50,9 @@ struct CreateDataArray output->SetNumberOfTuples(data[0].size()); auto range = vtk::DataArrayValueRange<NbComps>(output); - vtkSMPTools::For( - 0, static_cast<vtkIdType>(data[0].size()), [&](vtkIdType begin, vtkIdType end) { + vtkSMPTools::For(0, static_cast<vtkIdType>(data[0].size()), + [&](vtkIdType begin, vtkIdType end) + { for (vtkIdType idx = begin; idx < end; idx++) { for (vtkIdType comp = 0; comp < NbComps; comp++) diff --git a/IO/CONVERGECFD/vtkCONVERGECFDReader.cxx b/IO/CONVERGECFD/vtkCONVERGECFDReader.cxx index 88a41a5730c..821d9107c68 100644 --- a/IO/CONVERGECFD/vtkCONVERGECFDReader.cxx +++ b/IO/CONVERGECFD/vtkCONVERGECFDReader.cxx @@ -1295,9 +1295,8 @@ void vtkCONVERGECFDReader::ReadTimeSteps(vtkInformation* outInfo) // Sort files and times by time std::sort(timesAndFiles.begin(), timesAndFiles.end(), - [](const std::pair<double, std::string>& left, const std::pair<double, std::string>& right) { - return left.first < right.first; - }); + [](const std::pair<double, std::string>& left, const std::pair<double, std::string>& right) + { return left.first < right.first; }); std::vector<double> times; // Reset the FileNames vector in chronological order diff --git a/IO/CatalystConduit/vtkConduitSource.cxx b/IO/CatalystConduit/vtkConduitSource.cxx index e5bd17136cf..789befb0926 100644 --- a/IO/CatalystConduit/vtkConduitSource.cxx +++ b/IO/CatalystConduit/vtkConduitSource.cxx @@ -167,7 +167,8 @@ bool vtkConduitSource::GeneratePartitionedDataSetCollection(vtkDataObject* outpu { vtkNew<vtkDataAssembly> assembly; std::function<void(int, const conduit_cpp::Node&)> helper; - helper = [&name_map, &assembly, &helper](int parent, const conduit_cpp::Node& node) { + helper = [&name_map, &assembly, &helper](int parent, const conduit_cpp::Node& node) + { if (node.dtype().is_object()) { for (conduit_index_t cc = 0; cc < node.number_of_children(); ++cc) @@ -221,9 +222,9 @@ int vtkConduitSource::RequestDataObject( vtkInformation*, vtkInformationVector**, vtkInformationVector* outputVector) { const int dataType = this->OutputMultiBlock ? VTK_MULTIBLOCK_DATA_SET - : this->UseMultiMeshProtocol - ? VTK_PARTITIONED_DATA_SET_COLLECTION - : this->UseAMRMeshProtocol ? VTK_OVERLAPPING_AMR : VTK_PARTITIONED_DATA_SET; + : this->UseMultiMeshProtocol ? VTK_PARTITIONED_DATA_SET_COLLECTION + : this->UseAMRMeshProtocol ? VTK_OVERLAPPING_AMR + : VTK_PARTITIONED_DATA_SET; return this->SetOutputDataObject(dataType, outputVector->GetInformationObject(0), /*exact=*/true) ? 1 diff --git a/IO/Cesium3DTiles/TreeInformation.cxx b/IO/Cesium3DTiles/TreeInformation.cxx index f5e96d06864..e4682c141b1 100644 --- a/IO/Cesium3DTiles/TreeInformation.cxx +++ b/IO/Cesium3DTiles/TreeInformation.cxx @@ -648,31 +648,32 @@ void TreeInformation::SaveTileBuildings(vtkIncrementalOctreeNode* node, void* au // accumulate all texture file names and tcoords std::function<bool(vtkPolyData*)> accumulateNamesAndTCoords = [&meshes, &numberOfTextures, &meshTextureFileNames, &meshTCoords, &meshesWithTexture]( - vtkPolyData* pd) { - auto pdTextureFileNames = vtkGLTFWriter::GetFieldAsStringVector(pd, "texture_uri"); - if (pdTextureFileNames.empty()) - { - meshes.push_back(pd); - } - else + vtkPolyData* pd) + { + auto pdTextureFileNames = vtkGLTFWriter::GetFieldAsStringVector(pd, "texture_uri"); + if (pdTextureFileNames.empty()) + { + meshes.push_back(pd); + } + else + { + if (numberOfTextures && numberOfTextures != pdTextureFileNames.size()) { - if (numberOfTextures && numberOfTextures != pdTextureFileNames.size()) - { - vtkLog(ERROR, - "Different polydata in the tile have different " - "number of textures " - << pdTextureFileNames.size() << " expecting " << numberOfTextures); - // disable texture merging - numberOfTextures = 0; - return false; - } - numberOfTextures = pdTextureFileNames.size(); - meshesWithTexture.push_back(pd); - meshTextureFileNames.push_back(pdTextureFileNames); - meshTCoords.push_back(pd->GetPointData()->GetTCoords()); + vtkLog(ERROR, + "Different polydata in the tile have different " + "number of textures " + << pdTextureFileNames.size() << " expecting " << numberOfTextures); + // disable texture merging + numberOfTextures = 0; + return false; } - return true; - }; + numberOfTextures = pdTextureFileNames.size(); + meshesWithTexture.push_back(pd); + meshTextureFileNames.push_back(pdTextureFileNames); + meshTCoords.push_back(pd->GetPointData()->GetTCoords()); + } + return true; + }; this->ForEachBuilding(node, accumulateNamesAndTCoords); // how many polydata textures along one side of the merged texture @@ -698,8 +699,9 @@ void TreeInformation::SaveTileBuildings(vtkIncrementalOctreeNode* node, void* au // sorted on decreasing height of textures std::vector<size_t> textureIds(tileTextures.size()); std::iota(textureIds.begin(), textureIds.end(), 0); - std::sort( - textureIds.begin(), textureIds.end(), [tileTextures](size_t first, size_t second) { + std::sort(textureIds.begin(), textureIds.end(), + [tileTextures](size_t first, size_t second) + { double* firstBounds = tileTextures[first]->GetBounds(); double* secondBounds = tileTextures[second]->GetBounds(); return (firstBounds[3] - firstBounds[2]) > (secondBounds[3] - secondBounds[2]); @@ -857,9 +859,8 @@ vtkSmartPointer<vtkImageData> TreeInformation::SplitTileTexture( } // sort decreasing on height of the BB std::sort(scatteredRegions.begin(), scatteredRegions.end(), - [](const RegionCellId& first, const RegionCellId& second) { - return (first.Region[3] - first.Region[2]) > (second.Region[3] - second.Region[2]); - }); + [](const RegionCellId& first, const RegionCellId& second) + { return (first.Region[3] - first.Region[2]) > (second.Region[3] - second.Region[2]); }); // approximate the width in pixels of the new image float average = 0.0f; for (size_t i = 0; i < scatteredRegions.size(); ++i) @@ -1510,7 +1511,8 @@ bool TreeInformation::ConvertTileCartesianBuildings(vtkIncrementalOctreeNode* no P = P_for_GIS; // transform points to Cartesian coordinates - std::function<bool(vtkPolyData*)> transformPointToCartesian = [P](vtkPolyData* pd) { + std::function<bool(vtkPolyData*)> transformPointToCartesian = [P](vtkPolyData* pd) + { vtkDataArray* points = pd->GetPoints()->GetData(); vtkNew<vtkDoubleArray> newPoints; vtkDoubleArray* da = vtkArrayDownCast<vtkDoubleArray>(points); diff --git a/IO/Core/vtkResourceParser.cxx b/IO/Core/vtkResourceParser.cxx index 99bfa13847d..be2c52858dd 100644 --- a/IO/Core/vtkResourceParser.cxx +++ b/IO/Core/vtkResourceParser.cxx @@ -331,15 +331,17 @@ private: if (this->StopOnNewLine) { bool newLine{}; - const auto result = this->DiscardUntil([&discardPred, &newLine](char c) { - if (c == '\r' || c == '\n') + const auto result = this->DiscardUntil( + [&discardPred, &newLine](char c) { - newLine = true; - return true; - } + if (c == '\r' || c == '\n') + { + newLine = true; + return true; + } - return !discardPred(c); - }); + return !discardPred(c); + }); if (newLine) { @@ -413,8 +415,8 @@ vtkParseResult vtkResourceParser::vtkInternals::Parse<std::string>( break; } - const auto receiver = [&output]( - const char* data, std::size_t size) { output.append(data, size); }; + const auto receiver = [&output](const char* data, std::size_t size) + { output.append(data, size); }; this->ReadUntil(discardPred, receiver, std::numeric_limits<std::size_t>::max()); @@ -550,14 +552,12 @@ void vtkResourceParser::vtkParserContext::PrintSelf(ostream& os, vtkIndent inden const vtkResourceParser::PredicateType vtkResourceParser::DiscardNone = [](char) { return false; }; //------------------------------------------------------------------------------ -const vtkResourceParser::PredicateType vtkResourceParser::DiscardWhitespace = [](char c) { - return std::isspace(static_cast<unsigned char>(c)); -}; +const vtkResourceParser::PredicateType vtkResourceParser::DiscardWhitespace = [](char c) +{ return std::isspace(static_cast<unsigned char>(c)); }; //------------------------------------------------------------------------------ -const vtkResourceParser::PredicateType vtkResourceParser::DiscardNonAlphaNumeric = [](char c) { - return !std::isalnum(static_cast<unsigned char>(c)); -}; +const vtkResourceParser::PredicateType vtkResourceParser::DiscardNonAlphaNumeric = [](char c) +{ return !std::isalnum(static_cast<unsigned char>(c)); }; //------------------------------------------------------------------------------ vtkStandardNewMacro(vtkResourceParser); diff --git a/IO/Core/vtkResourceParser.h b/IO/Core/vtkResourceParser.h index 03c64c77d1b..13b38554ea8 100644 --- a/IO/Core/vtkResourceParser.h +++ b/IO/Core/vtkResourceParser.h @@ -363,7 +363,8 @@ public: { const auto result = this->ReadUntil( discardPred, - [&output](const char* data, std::size_t size) mutable { + [&output](const char* data, std::size_t size) mutable + { for (std::size_t i{}; i < size; ++i) { *output++ = data[i]; @@ -475,7 +476,8 @@ public: ReadToResult<OutputIt> ReadLineTo(OutputIt output, std::size_t limit = NoLimit) { const auto result = this->ReadLine( - [&output](const char* data, std::size_t size) { + [&output](const char* data, std::size_t size) + { for (std::size_t i{}; i < size; ++i) { *output++ = data[i]; diff --git a/IO/Core/vtkURI.cxx b/IO/Core/vtkURI.cxx index 44609cdb822..26938386b23 100644 --- a/IO/Core/vtkURI.cxx +++ b/IO/Core/vtkURI.cxx @@ -57,9 +57,9 @@ bool IsPChar(char c) // Scheme -> Authority -> Path -> Query -> Fragment const char* ExtractScheme(const char* uri, const char* end, vtkURIComponent& output) { - const auto schemeEnd = std::find_if_not(uri, end, [](char c) { - return std::isalnum(static_cast<unsigned char>(c)) || c == '+' || c == '-' || c == '.'; - }); + const auto schemeEnd = std::find_if_not(uri, end, + [](char c) + { return std::isalnum(static_cast<unsigned char>(c)) || c == '+' || c == '-' || c == '.'; }); if (schemeEnd == end || *schemeEnd != ':') { @@ -221,9 +221,9 @@ bool CheckSchemeSyntax(const vtkURIComponent& comp) return false; } - auto illegalChar = std::find_if_not(scheme.begin(), scheme.end(), [](char c) { - return std::isalnum(static_cast<unsigned char>(c)) || c == '+' || c == '-' || c == '.'; - }); + auto illegalChar = std::find_if_not(scheme.begin(), scheme.end(), + [](char c) + { return std::isalnum(static_cast<unsigned char>(c)) || c == '+' || c == '-' || c == '.'; }); if (illegalChar != scheme.end()) { diff --git a/IO/ERF/vtkERFReader.cxx b/IO/ERF/vtkERFReader.cxx index 2b503c0cda0..51c611e5872 100644 --- a/IO/ERF/vtkERFReader.cxx +++ b/IO/ERF/vtkERFReader.cxx @@ -930,7 +930,8 @@ std::string vtkERFReader::GetAttributeValueAsStr( if (H5Aread(attributeHandler, dataType, &value[0]) >= 0) { value.erase(std::remove_if(value.begin(), value.end(), - [](char c) { + [](char c) + { // convert it to avoid potential issue wit negative char unsigned char uc = static_cast<unsigned char>(c); return std::isspace(uc) || !std::isalpha(uc); diff --git a/IO/EnSight/core/EnSightDataSet.cxx b/IO/EnSight/core/EnSightDataSet.cxx index 8536a187b37..efca43a662d 100644 --- a/IO/EnSight/core/EnSightDataSet.cxx +++ b/IO/EnSight/core/EnSightDataSet.cxx @@ -387,9 +387,9 @@ void readCaseFileValues(EnSightFile& file, std::string& line, std::vector<T>& va if (continueReading) { line = result.second; - if (!std::all_of(line.begin(), line.end(), [](char c) -> bool { - return isdigit(c) || isspace(c) || c == '.' || c == 'e' || c == '+' || c == '-'; - })) + if (!std::all_of(line.begin(), line.end(), + [](char c) -> bool + { return isdigit(c) || isspace(c) || c == '.' || c == 'e' || c == '+' || c == '-'; })) { // The current line is not more time step values, so reset // this line so we can continue processing. @@ -1776,14 +1776,16 @@ vtkSmartPointer<vtkFloatArray> EnSightDataSet::ReadVariableArray( file.ReadArray(&buffer.front(), count); partialIndices->SetNumberOfIds(count); - std::transform( - buffer.begin(), buffer.end(), partialIndices->WritePointer(0, count), [](vtkIdType val) { + std::transform(buffer.begin(), buffer.end(), partialIndices->WritePointer(0, count), + [](vtkIdType val) + { return val - 1; /* since ensight indices start with 1*/ }); } // replace undefined values with "internal undef" which in ParaView is NaN - auto replaceUndef = [&](vtkFloatArray* farray) { + auto replaceUndef = [&](vtkFloatArray* farray) + { if (hasUndef) { for (vtkIdType cc = 0; cc < numElements; ++cc) @@ -1796,7 +1798,8 @@ vtkSmartPointer<vtkFloatArray> EnSightDataSet::ReadVariableArray( } }; - auto readComponent = [&](vtkIdType count) { + auto readComponent = [&](vtkIdType count) + { vtkNew<vtkFloatArray> buffer; buffer->SetNumberOfTuples(count); if (hasPartial) @@ -2264,7 +2267,8 @@ void EnSightDataSet::CreateStructuredGridOutput(const GridOptions& opts, vtkStru vtkNew<vtkPoints> points; points->SetNumberOfPoints(numPts); - auto readComponent = [&](vtkIdType count) { + auto readComponent = [&](vtkIdType count) + { vtkNew<vtkFloatArray> buffer; buffer->SetNumberOfTuples(count); this->GeometryFile.ReadArray(buffer->WritePointer(0, count), count); @@ -2367,7 +2371,8 @@ void EnSightDataSet::CreateUnstructuredGridOutput( vtkNew<vtkPoints> points; points->SetNumberOfPoints(numPts); - auto readComponent = [&](vtkIdType count) { + auto readComponent = [&](vtkIdType count) + { vtkNew<vtkFloatArray> buffer; buffer->SetNumberOfTuples(count); this->GeometryFile.ReadArray(buffer->WritePointer(0, count), count); diff --git a/IO/EnSight/vtkEnSight6BinaryReader.cxx b/IO/EnSight/vtkEnSight6BinaryReader.cxx index 1f26a171c26..f99c21ad65a 100644 --- a/IO/EnSight/vtkEnSight6BinaryReader.cxx +++ b/IO/EnSight/vtkEnSight6BinaryReader.cxx @@ -2721,7 +2721,8 @@ int vtkEnSight6BinaryReader::ReadIntNumber(int* result) // Compare to file size, being careful not to overflow the // multiplication (by doing 64 bit math). Also check for overflow errors. // Use negative value as an indication of bad number. - auto checkByteOrderConsistency = [&](int& temporarySize) { + auto checkByteOrderConsistency = [&](int& temporarySize) + { if (temporarySize < 0) { temporarySize = -1; diff --git a/IO/EnSight/vtkEnSightGoldBinaryReader.cxx b/IO/EnSight/vtkEnSightGoldBinaryReader.cxx index 75c126a2b0c..58897a5c14a 100644 --- a/IO/EnSight/vtkEnSightGoldBinaryReader.cxx +++ b/IO/EnSight/vtkEnSightGoldBinaryReader.cxx @@ -79,14 +79,16 @@ public: self->ReadIntArray(&buffer.front(), count); partialIndices->SetNumberOfIds(count); - std::transform( - buffer.begin(), buffer.end(), partialIndices->GetPointer(0), [](vtkIdType val) { + std::transform(buffer.begin(), buffer.end(), partialIndices->GetPointer(0), + [](vtkIdType val) + { return val - 1; /* since ensight indices start with 1*/ }); } // replace undefined values with "internal undef" which in ParaView is NaN - auto replaceUndef = [&](vtkFloatArray* farray) { + auto replaceUndef = [&](vtkFloatArray* farray) + { if (hasUndef) { const float nanfloat = std::nanf("1"); @@ -100,7 +102,8 @@ public: } }; - auto readComponent = [&](vtkIdType count) { + auto readComponent = [&](vtkIdType count) + { vtkNew<vtkFloatArray> buffer; buffer->SetNumberOfTuples(count); if (hasPartial) @@ -1560,7 +1563,8 @@ bool vtkEnSightGoldBinaryReader::ReadVariableArray(const char* description, // read description. this->ReadLine(line); - auto advance = [&line, this]() { + auto advance = [&line, this]() + { this->GoldIFile->peek(); return this->GoldIFile->eof() ? 0 : this->ReadLine(line); }; diff --git a/IO/Exodus/Testing/Cxx/TestInSituExodus.cxx b/IO/Exodus/Testing/Cxx/TestInSituExodus.cxx index 250432961e9..08af299f984 100644 --- a/IO/Exodus/Testing/Cxx/TestInSituExodus.cxx +++ b/IO/Exodus/Testing/Cxx/TestInSituExodus.cxx @@ -41,7 +41,7 @@ // Define this to work around "glommed" point/cell data in the reference data. #undef GLOM_WORKAROUND -//#define GLOM_WORKAROUND +// #define GLOM_WORKAROUND // See issue # #define vtkContourFilter_IS_FIXED 0 @@ -666,11 +666,11 @@ void printTimingInfo( // Define this to profile a particular filter (see testFilters(...)). #undef PROFILE -//#define PROFILE CURRENT_TEST +// #define PROFILE CURRENT_TEST // Define this to benchmark a particular filter (see testFilters(...)). #undef BENCHMARK -//#define BENCHMARK CURRENT_TEST +// #define BENCHMARK CURRENT_TEST bool testFilters(vtkUnstructuredGridBase* ref, vtkUnstructuredGridBase* test) { diff --git a/IO/Exodus/vtkCPExodusIIResultsArrayTemplate.txx b/IO/Exodus/vtkCPExodusIIResultsArrayTemplate.txx index 3ffa23c2d44..8b344e73765 100644 --- a/IO/Exodus/vtkCPExodusIIResultsArrayTemplate.txx +++ b/IO/Exodus/vtkCPExodusIIResultsArrayTemplate.txx @@ -497,7 +497,7 @@ vtkCPExodusIIResultsArrayTemplate<Scalar>::~vtkCPExodusIIResultsArrayTemplate() { for (ArrayIterator it = this->Arrays.begin(), itEnd = this->Arrays.end(); it != itEnd; ++it) { - delete[] * it; + delete[] *it; } } delete[] this->TempDoubleArray; diff --git a/IO/Exodus/vtkExodusIICache.cxx b/IO/Exodus/vtkExodusIICache.cxx index ec2948ba4bf..c78fde77d95 100644 --- a/IO/Exodus/vtkExodusIICache.cxx +++ b/IO/Exodus/vtkExodusIICache.cxx @@ -6,7 +6,7 @@ #include "vtkObjectFactory.h" // Define VTK_EXO_DBG_CACHE to print cache adds, drops, and replacements. -//#undef VTK_EXO_DBG_CACHE +// #undef VTK_EXO_DBG_CACHE #define VTK_EXO_PRT_KEY(ckey) \ "(" << (ckey).Time << ", " << (ckey).ObjectType << ", " << (ckey).ObjectId << ", " \ diff --git a/IO/Export/vtkX3DExporterFIWriter.cxx b/IO/Export/vtkX3DExporterFIWriter.cxx index e35d945bcb5..c4545d3e8e0 100644 --- a/IO/Export/vtkX3DExporterFIWriter.cxx +++ b/IO/Export/vtkX3DExporterFIWriter.cxx @@ -16,7 +16,7 @@ #include <sstream> #include <vector> -//#define ENCODEASSTRING 1 +// #define ENCODEASSTRING 1 using namespace vtkX3D; diff --git a/IO/Export/vtkX3DExporterFIWriterHelper.h b/IO/Export/vtkX3DExporterFIWriterHelper.h index 59e87b5fe68..e26fb5fc7b0 100644 --- a/IO/Export/vtkX3DExporterFIWriterHelper.h +++ b/IO/Export/vtkX3DExporterFIWriterHelper.h @@ -8,7 +8,7 @@ #ifndef vtkX3DExporterFIWriterHelper_h #define vtkX3DExporterFIWriterHelper_h -//#include "vtkX3DExporterFIByteWriter.h" +// #include "vtkX3DExporterFIByteWriter.h" #include "vtkZLibDataCompressor.h" #include <cassert> @@ -22,7 +22,8 @@ VTK_ABI_NAMESPACE_BEGIN class vtkX3DExporterFIWriterHelper { public: - union float_to_unsigned_int_to_bytes { + union float_to_unsigned_int_to_bytes + { float f; unsigned int ui; unsigned char ub[4]; // unsigned bytes @@ -329,7 +330,8 @@ public: const double* vd = value; for (i = 0; i < size; i++) { - union float_to_unsigned_int_to_bytes { + union float_to_unsigned_int_to_bytes + { float f; unsigned int ui; unsigned char ub[4]; // unsigned bytes diff --git a/IO/ExportPDF/Testing/Cxx/TestPDFTransformedText.cxx b/IO/ExportPDF/Testing/Cxx/TestPDFTransformedText.cxx index 4d493444ce3..99efdb56d93 100644 --- a/IO/ExportPDF/Testing/Cxx/TestPDFTransformedText.cxx +++ b/IO/ExportPDF/Testing/Cxx/TestPDFTransformedText.cxx @@ -152,7 +152,8 @@ void TransformedTextPDFTest::PaintCell( int vJust; std::tie(hJust, vJust) = JustArray[justIdx]; - auto scaleToStr = [](double scale) -> std::string { + auto scaleToStr = [](double scale) -> std::string + { if (scale < 0.5) { return "S"; diff --git a/IO/FDS/vtkFDSReader.cxx b/IO/FDS/vtkFDSReader.cxx index 9fd1ad667ee..c730975fb51 100644 --- a/IO/FDS/vtkFDSReader.cxx +++ b/IO/FDS/vtkFDSReader.cxx @@ -666,7 +666,8 @@ public: vtkNew<vtkPolyData> device; - auto setSingleVector = [](vtkDoubleArray* arr, const std::array<double, 3>& vec) { + auto setSingleVector = [](vtkDoubleArray* arr, const std::array<double, 3>& vec) + { arr->SetNumberOfComponents(3); arr->SetNumberOfTuples(1); for (std::size_t iDim = 0; iDim < 3; ++iDim) @@ -1243,8 +1244,8 @@ int vtkFDSReader::RequestInformation(vtkInformation* vtkNotUsed(request), // tolerance of this->TimeTolerance std::set<double> uniqueSortedTimeValues; - auto insertIntoSet = [&uniqueSortedTimeValues]( - double val) { uniqueSortedTimeValues.insert(val); }; + auto insertIntoSet = [&uniqueSortedTimeValues](double val) + { uniqueSortedTimeValues.insert(val); }; for (auto& devcFileData : this->Internals->DevcFiles) { diff --git a/IO/FFMPEG/Testing/Cxx/TestFFMPEGVideoSourceWithAudio.cxx b/IO/FFMPEG/Testing/Cxx/TestFFMPEGVideoSourceWithAudio.cxx index b5f9ae52da2..0ef74e71ce3 100644 --- a/IO/FFMPEG/Testing/Cxx/TestFFMPEGVideoSourceWithAudio.cxx +++ b/IO/FFMPEG/Testing/Cxx/TestFFMPEGVideoSourceWithAudio.cxx @@ -95,7 +95,8 @@ void setupAudioPlayback(vtkFFMPEGVideoSource* video) // debugc.BreakMask = XAUDIO2_LOG_ERRORS; // pXAudio2->SetDebugConfiguration(&debugc, nullptr); - auto cbfunc = [pXAudio2](vtkFFMPEGVideoSourceAudioCallbackData& acbd) { + auto cbfunc = [pXAudio2](vtkFFMPEGVideoSourceAudioCallbackData& acbd) + { HRESULT hr; static IXAudio2SourceVoice* pSourceVoice = nullptr; static int currentBufferIndex = 0; diff --git a/IO/Geometry/Testing/Cxx/TestOBJReaderGroups.cxx b/IO/Geometry/Testing/Cxx/TestOBJReaderGroups.cxx index 7ca815c70d0..c2f0753582b 100644 --- a/IO/Geometry/Testing/Cxx/TestOBJReaderGroups.cxx +++ b/IO/Geometry/Testing/Cxx/TestOBJReaderGroups.cxx @@ -63,7 +63,8 @@ static bool CheckOBJGroups(const std::string& filename, const int maxExpected) int TestOBJReaderGroups(int argc, char* argv[]) { // lambda for the testing - auto doTesting = [&](int maxExpected, const char* dataName) -> bool { + auto doTesting = [&](int maxExpected, const char* dataName) -> bool + { char* fname = vtkTestUtilities::ExpandDataFileName(argc, argv, dataName); std::string filename(fname); delete[] fname; diff --git a/IO/Geometry/vtkChacoReader.cxx b/IO/Geometry/vtkChacoReader.cxx index 6c9c08c8cbb..ff22178532d 100644 --- a/IO/Geometry/vtkChacoReader.cxx +++ b/IO/Geometry/vtkChacoReader.cxx @@ -1222,16 +1222,16 @@ done: if ((vertex == 0) || (retVal == 0)) { /* Graph was empty */ - delete[] * start; + delete[] *start; *start = nullptr; - delete[] * adjacency; + delete[] *adjacency; *adjacency = nullptr; - delete[] * vweights; + delete[] *vweights; *vweights = nullptr; - delete[] * eweights; + delete[] *eweights; *eweights = nullptr; } diff --git a/IO/Geometry/vtkFLUENTReader.cxx b/IO/Geometry/vtkFLUENTReader.cxx index ee172f4e001..16aaaffc343 100644 --- a/IO/Geometry/vtkFLUENTReader.cxx +++ b/IO/Geometry/vtkFLUENTReader.cxx @@ -3161,7 +3161,8 @@ void vtkFLUENTReader::PopulateCellNodes() //------------------------------------------------------------------------------ int vtkFLUENTReader::GetCaseBufferInt(int ptr) { - union mix_i { + union mix_i + { int i; char c[4]; } mi = { 1 }; @@ -3183,7 +3184,8 @@ int vtkFLUENTReader::GetCaseBufferInt(int ptr) //------------------------------------------------------------------------------ float vtkFLUENTReader::GetCaseBufferFloat(int ptr) { - union mix_f { + union mix_f + { float f; char c[4]; } mf = { 1.0 }; @@ -3205,7 +3207,8 @@ float vtkFLUENTReader::GetCaseBufferFloat(int ptr) //------------------------------------------------------------------------------ double vtkFLUENTReader::GetCaseBufferDouble(int ptr) { - union mix_i { + union mix_i + { double d; char c[8]; } md = { 1.0 }; @@ -3844,7 +3847,8 @@ void vtkFLUENTReader::ParseDataFile() //------------------------------------------------------------------------------ int vtkFLUENTReader::GetDataBufferInt(int ptr) { - union mix_i { + union mix_i + { int i; char c[4]; } mi = { 1 }; @@ -3866,7 +3870,8 @@ int vtkFLUENTReader::GetDataBufferInt(int ptr) //------------------------------------------------------------------------------ float vtkFLUENTReader::GetDataBufferFloat(int ptr) { - union mix_f { + union mix_f + { float f; char c[4]; } mf = { 1.0 }; @@ -3888,7 +3893,8 @@ float vtkFLUENTReader::GetDataBufferFloat(int ptr) //------------------------------------------------------------------------------ double vtkFLUENTReader::GetDataBufferDouble(int ptr) { - union mix_i { + union mix_i + { double d; char c[8]; } md = { 1.0 }; diff --git a/IO/Geometry/vtkGLTFDocumentLoaderInternals.cxx b/IO/Geometry/vtkGLTFDocumentLoaderInternals.cxx index 14ce126f38d..d70da8486d2 100644 --- a/IO/Geometry/vtkGLTFDocumentLoaderInternals.cxx +++ b/IO/Geometry/vtkGLTFDocumentLoaderInternals.cxx @@ -1325,8 +1325,8 @@ bool vtkGLTFDocumentLoaderInternals::LoadModelMetaData( // This is only for warnings. extensionsRequired is a subset of extensionsUsed, which is what is // used to fill extensionsUsedByLoader. if (!std::any_of(supportedExtensions.begin(), supportedExtensions.end(), - [&extensionRequiredByModel]( - const std::string& value) { return value == extensionRequiredByModel; })) + [&extensionRequiredByModel](const std::string& value) + { return value == extensionRequiredByModel; })) { vtkErrorWithObjectMacro(this->Self, "glTF extension " @@ -1344,8 +1344,8 @@ bool vtkGLTFDocumentLoaderInternals::LoadModelMetaData( continue; } if (std::any_of(supportedExtensions.begin(), supportedExtensions.end(), - [&extensionUsedByModel]( - const std::string& value) { return value == extensionUsedByModel; })) + [&extensionUsedByModel](const std::string& value) + { return value == extensionUsedByModel; })) { extensionsUsedByLoader.push_back(extensionUsedByModel); } diff --git a/IO/Geometry/vtkHoudiniPolyDataWriter.cxx b/IO/Geometry/vtkHoudiniPolyDataWriter.cxx index 2bf61c76d0d..f3ba8d8a430 100644 --- a/IO/Geometry/vtkHoudiniPolyDataWriter.cxx +++ b/IO/Geometry/vtkHoudiniPolyDataWriter.cxx @@ -60,13 +60,22 @@ struct AttributeTrait; { \ typedef attType Type; \ typedef vtkArray vtkArrayType; \ - std::string Name() const { return std::string(attName); } \ - attType Default() const { return static_cast<attType>(attDefault); } \ + std::string Name() const \ + { \ + return std::string(attName); \ + } \ + attType Default() const \ + { \ + return static_cast<attType>(attDefault); \ + } \ static void Get(vtkIdType index, attType* in, vtkArray* array) \ { \ array->GetTypedTuple(index, in); \ } \ - static void Stream(std::ostream& out, attType t) { out << t; } \ + static void Stream(std::ostream& out, attType t) \ + { \ + out << t; \ + } \ } DefineAttributeTrait(VTK_DOUBLE, double, "float", vtkDoubleArray, 0.0); diff --git a/IO/Geometry/vtkMFIXReader.cxx b/IO/Geometry/vtkMFIXReader.cxx index 6ce25a7450a..c0b4a0e8e4e 100644 --- a/IO/Geometry/vtkMFIXReader.cxx +++ b/IO/Geometry/vtkMFIXReader.cxx @@ -718,7 +718,8 @@ void vtkMFIXReader::SwapInt(int& value) //------------------------------------------------------------------------------ void vtkMFIXReader::SwapDouble(double& value) { - union Swap { + union Swap + { double valDouble; unsigned char valByte[8]; }; @@ -742,7 +743,8 @@ void vtkMFIXReader::SwapDouble(double& value) //------------------------------------------------------------------------------ void vtkMFIXReader::SwapFloat(float& value) { - union Swap { + union Swap + { float valFloat; unsigned char valByte[4]; }; diff --git a/IO/Geometry/vtkOBJReader.cxx b/IO/Geometry/vtkOBJReader.cxx index 3c162310e4e..60fef170709 100644 --- a/IO/Geometry/vtkOBJReader.cxx +++ b/IO/Geometry/vtkOBJReader.cxx @@ -206,7 +206,8 @@ int vtkOBJReader::RequestData(vtkInformation* vtkNotUsed(request), std::string tcoordsName; // name of active tcoords int lineNumber = 0; // current line number - const auto flushLine = [this, &parser, &lineNumber]() { + const auto flushLine = [this, &parser, &lineNumber]() + { std::string remaining; auto result = parser->Parse(remaining); diff --git a/IO/Geometry/vtkOpenFOAMReader.cxx b/IO/Geometry/vtkOpenFOAMReader.cxx index 8d54c4cb10c..6d1dc27aded 100644 --- a/IO/Geometry/vtkOpenFOAMReader.cxx +++ b/IO/Geometry/vtkOpenFOAMReader.cxx @@ -1576,7 +1576,8 @@ public: protected: tokenType Type = tokenType::UNDEFINED; - union { + union + { char Char; vtkTypeInt64 Int; double Double; @@ -1704,14 +1705,16 @@ public: float ToFloat() const noexcept { return this->Type == LABEL ? static_cast<float>(this->Int) - : this->Type == SCALAR ? static_cast<float>(this->Double) : 0.0F; + : this->Type == SCALAR ? static_cast<float>(this->Double) + : 0.0F; } // Mostly the same as To<double>, with additional check double ToDouble() const noexcept { return this->Type == LABEL ? static_cast<double>(this->Int) - : this->Type == SCALAR ? this->Double : 0.0; + : this->Type == SCALAR ? this->Double + : 0.0; } std::string ToString() const { return *this->StringPtr; } @@ -8136,8 +8139,9 @@ void vtkOpenFOAMReaderPrivate::InsertFacesToGrid(vtkPolyData* boundaryMesh, } } - const int vtkFaceType = - (nFacePoints == 3 ? VTK_TRIANGLE : nFacePoints == 4 ? VTK_QUAD : VTK_POLYGON); + const int vtkFaceType = (nFacePoints == 3 ? VTK_TRIANGLE + : nFacePoints == 4 ? VTK_QUAD + : VTK_POLYGON); bm.InsertNextCell(vtkFaceType, nFacePoints, facePointIds.data()); } } @@ -8576,19 +8580,21 @@ void vtkOpenFOAMReaderPrivate::InterpolateCellToPoint(vtkFloatArray* pData, vtkF auto area = vtk::DataArrayValueRange<1>(cData->GetArray("Area")); auto volume = vtk::DataArrayValueRange<1>(cData->GetArray("Volume")); auto reduce = vtk::DataArrayValueRange<1>(buffer); - vtkSMPTools::For(0, mesh->GetNumberOfCells(), [&](vtkIdType first, vtkIdType last) { - auto volIt = volume.begin() + first; - auto areaIt = area.begin() + first; - auto lenIt = length.begin() + first; - auto vcIt = vc.begin() + first; - for (auto it = reduce.begin() + first; it != reduce.begin() + last; - ++it, ++volIt, ++areaIt, ++lenIt, ++vcIt) - { - *it = (*volIt > 0 - ? *volIt - : (*areaIt > 0 ? *areaIt : (*lenIt > 0 ? *lenIt : (*vcIt > 0 ? *vcIt : -1.0)))); - } - }); + vtkSMPTools::For(0, mesh->GetNumberOfCells(), + [&](vtkIdType first, vtkIdType last) + { + auto volIt = volume.begin() + first; + auto areaIt = area.begin() + first; + auto lenIt = length.begin() + first; + auto vcIt = vc.begin() + first; + for (auto it = reduce.begin() + first; it != reduce.begin() + last; + ++it, ++volIt, ++areaIt, ++lenIt, ++vcIt) + { + *it = (*volIt > 0 + ? *volIt + : (*areaIt > 0 ? *areaIt : (*lenIt > 0 ? *lenIt : (*vcIt > 0 ? *vcIt : -1.0)))); + } + }); // this sanity check is necessary since the cell size filter does not yet seem able to support // all cell types. In certain configurations, all measures are 0 bool sanityCheckWeights = true; diff --git a/IO/Geometry/vtkTecplotReader.cxx b/IO/Geometry/vtkTecplotReader.cxx index 1e0788cdd6f..f92721d1ae6 100644 --- a/IO/Geometry/vtkTecplotReader.cxx +++ b/IO/Geometry/vtkTecplotReader.cxx @@ -1418,7 +1418,7 @@ void vtkTecplotReader::GetDataArraysList() } #define READ_UNTIL_TITLE_OR_VARIABLES \ - !this->Internal->NextCharEOF && theTpToken != "TITLE" && theTpToken != "VARIABLES" + !this->Internal->NextCharEOF&& theTpToken != "TITLE" && theTpToken != "VARIABLES" int i; int tpTokenLen = 0; int guessedXid = -1; @@ -1605,7 +1605,7 @@ void vtkTecplotReader::ReadFile(vtkMultiBlockDataSet* multZone) } #define READ_UNTIL_LINE_END \ - !this->Internal->NextCharEOF && tok != "TITLE" && tok != "VARIABLES" && tok != "ZONE" && \ + !this->Internal->NextCharEOF&& tok != "TITLE" && tok != "VARIABLES" && tok != "ZONE" && \ tok != "GEOMETRY" && tok != "TEXT" && tok != "DATASETAUXDATA" int zoneIndex = 0; bool firstToken = true; diff --git a/IO/H5part/vtkH5PartReader.cxx b/IO/H5part/vtkH5PartReader.cxx index 5d10346e718..3be9cab3df1 100644 --- a/IO/H5part/vtkH5PartReader.cxx +++ b/IO/H5part/vtkH5PartReader.cxx @@ -565,9 +565,8 @@ int vtkH5PartReader::RequestData(vtkInformation* vtkNotUsed(request), double requestedTimeValue = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()); auto toleranceCheck = H5PartToleranceCheck(this->TimeStepTolerance); this->ActualTimeStep = std::find_if(this->TimeStepValues.begin(), this->TimeStepValues.end(), - [&toleranceCheck, &requestedTimeValue](double timeStepValue) { - return toleranceCheck(timeStepValue, requestedTimeValue); - }) - + [&toleranceCheck, &requestedTimeValue](double timeStepValue) + { return toleranceCheck(timeStepValue, requestedTimeValue); }) - this->TimeStepValues.begin(); // if (requestedTimeValue < this->TimeStepValues.front() || diff --git a/IO/HDF/Testing/Cxx/TestHDFReaderTemporal.cxx b/IO/HDF/Testing/Cxx/TestHDFReaderTemporal.cxx index 08ac67850b5..ce3bb776a2f 100644 --- a/IO/HDF/Testing/Cxx/TestHDFReaderTemporal.cxx +++ b/IO/HDF/Testing/Cxx/TestHDFReaderTemporal.cxx @@ -373,14 +373,14 @@ int TestUGTemporalBase(OpenerWorklet& opener, bool testMeshMTime = false) CheckerWorklet checks(CHECK_TOLERANCE); // Point Data checks - auto getLHSPData = [&](vtkIdType iP) { + auto getLHSPData = [&](vtkIdType iP) + { std::array<double, 3> point = { 0 }; dSet->GetPoint(iP, point.data()); return ::Sin11T(dSet->GetFieldData()->GetArray("Time")->GetComponent(0, 0), point); }; - auto getRHSPData = [&](vtkIdType iP) { - return dSet->GetPointData()->GetArray("Modulator")->GetComponent(iP, 0); - }; + auto getRHSPData = [&](vtkIdType iP) + { return dSet->GetPointData()->GetArray("Modulator")->GetComponent(iP, 0); }; if (!checks(0, dSet->GetNumberOfPoints(), getLHSPData, getRHSPData)) { @@ -499,14 +499,14 @@ int TestUGTemporalPartitioned( CheckerWorklet checks(CHECK_TOLERANCE); // Point Data checks - auto getLHSPData = [&](vtkIdType iP) { + auto getLHSPData = [&](vtkIdType iP) + { std::array<double, 3> point = { 0 }; dSetPartition->GetPoint(iP, point.data()); return ::Sin11T(dSet->GetFieldData()->GetArray("Time")->GetComponent(0, 0), point); }; - auto getRHSPData = [&](vtkIdType iP) { - return dSetPartition->GetPointData()->GetArray("Modulator")->GetComponent(iP, 0); - }; + auto getRHSPData = [&](vtkIdType iP) + { return dSetPartition->GetPointData()->GetArray("Modulator")->GetComponent(iP, 0); }; if (!checks(0, dSetPartition->GetNumberOfPoints(), getLHSPData, getRHSPData)) { @@ -619,13 +619,13 @@ int TestImageDataTemporalBase(OpenerWorklet& opener) CheckerWorklet checks(CHECK_TOLERANCE); // Point Data checks - auto getLHSPData = [&](vtkIdType iP) { + auto getLHSPData = [&](vtkIdType iP) + { auto wave = refGeometry->GetPointData()->GetArray("RTData"); return dSet->GetFieldData()->GetArray("Time")->GetComponent(0, 0) * wave->GetComponent(iP, 0); }; - auto getRHSPData = [&](vtkIdType iP) { - return dSet->GetPointData()->GetArray("Modulator")->GetComponent(iP, 0); - }; + auto getRHSPData = [&](vtkIdType iP) + { return dSet->GetPointData()->GetArray("Modulator")->GetComponent(iP, 0); }; if (!checks(0, dSet->GetNumberOfPoints(), getLHSPData, getRHSPData)) { @@ -635,9 +635,8 @@ int TestImageDataTemporalBase(OpenerWorklet& opener) // Cell Data checks auto getLHSCData = [&](vtkIdType iC) { return iC; }; - auto getRHSCData = [&](vtkIdType iC) { - return dSet->GetCellData()->GetArray("IDs")->GetComponent(iC, 0); - }; + auto getRHSCData = [&](vtkIdType iC) + { return dSet->GetCellData()->GetArray("IDs")->GetComponent(iC, 0); }; if (!checks(0, dSet->GetNumberOfCells(), getLHSCData, getRHSCData)) { diff --git a/IO/HDF/vtkHDFReader.cxx b/IO/HDF/vtkHDFReader.cxx index 28646e2349c..8292e154b74 100644 --- a/IO/HDF/vtkHDFReader.cxx +++ b/IO/HDF/vtkHDFReader.cxx @@ -121,7 +121,8 @@ bool ReadPolyDataPiece(T* impl, std::shared_ptr<CacheT> cache, vtkIdType pointOf std::vector<vtkIdType>& numberOfCells, std::vector<vtkIdType>& connectivityOffsets, std::vector<vtkIdType>& numberOfConnectivityIds, int filePiece, vtkPolyData* pieceData) { - auto readFromFileOrCache = [&](int tag, std::string name, vtkIdType offset, vtkIdType size) { + auto readFromFileOrCache = [&](int tag, std::string name, vtkIdType offset, vtkIdType size) + { std::string modifier = "_" + std::to_string(filePiece); return ReadFromFileOrCache(impl, cache, tag, name, modifier, offset, size); }; @@ -890,8 +891,9 @@ int vtkHDFReader::Read(const std::vector<vtkIdType>& numberOfPoints, vtkIdType startingPointOffset, vtkIdType startingCellOffset, vtkIdType startingConnectivityIdOffset, int filePiece, vtkUnstructuredGrid* pieceData) { - auto readFromFileOrCache = [&](int tag, std::string name, vtkIdType offset, vtkIdType size, - bool mData) { + auto readFromFileOrCache = + [&](int tag, std::string name, vtkIdType offset, vtkIdType size, bool mData) + { std::string modifier = "_" + std::to_string(filePiece); return ::ReadFromFileOrCache( this->Impl, this->UseCache ? this->Cache : nullptr, tag, name, modifier, offset, size, mData); diff --git a/IO/HDF/vtkHDFUtilities.txx b/IO/HDF/vtkHDFUtilities.txx index 885f36d2f16..7b863369c92 100644 --- a/IO/HDF/vtkHDFUtilities.txx +++ b/IO/HDF/vtkHDFUtilities.txx @@ -9,7 +9,8 @@ VTK_ABI_NAMESPACE_BEGIN template <class T> vtkHDFUtilities::TransientGeometryOffsets::TransientGeometryOffsets(T* impl, vtkIdType step) { - auto recupMultiOffset = [&](std::string path, std::vector<vtkIdType>& val) { + auto recupMultiOffset = [&](std::string path, std::vector<vtkIdType>& val) + { val = impl->GetMetadata(path.c_str(), 1, step); if (val.empty()) { @@ -19,7 +20,8 @@ vtkHDFUtilities::TransientGeometryOffsets::TransientGeometryOffsets(T* impl, vtk } return true; }; - auto recupSingleOffset = [&](std::string path, vtkIdType& val) { + auto recupSingleOffset = [&](std::string path, vtkIdType& val) + { std::vector<vtkIdType> buffer; if (!recupMultiOffset(path, buffer)) { @@ -54,7 +56,8 @@ vtkHDFUtilities::TransientGeometryOffsets::TransientGeometryOffsets(T* impl, vtk template <class T> vtkHDFUtilities::TemporalGeometryOffsets::TemporalGeometryOffsets(T* impl, vtkIdType step) { - auto recupMultiOffset = [&](std::string path, std::vector<vtkIdType>& val) { + auto recupMultiOffset = [&](std::string path, std::vector<vtkIdType>& val) + { val = impl->GetMetadata(path.c_str(), 1, step); if (val.empty()) { @@ -64,7 +67,8 @@ vtkHDFUtilities::TemporalGeometryOffsets::TemporalGeometryOffsets(T* impl, vtkId } return true; }; - auto recupSingleOffset = [&](std::string path, vtkIdType& val) { + auto recupSingleOffset = [&](std::string path, vtkIdType& val) + { std::vector<vtkIdType> buffer; if (!recupMultiOffset(path, buffer)) { diff --git a/IO/HDFTools/vtkHDF5ScopedHandle.h b/IO/HDFTools/vtkHDF5ScopedHandle.h index 8c0de43c361..fe424d10aa9 100644 --- a/IO/HDFTools/vtkHDF5ScopedHandle.h +++ b/IO/HDFTools/vtkHDF5ScopedHandle.h @@ -46,7 +46,10 @@ VTK_ABI_NAMESPACE_BEGIN } \ } \ \ - operator hid_t() const { return this->Handle; } \ + operator hid_t() const \ + { \ + return this->Handle; \ + } \ \ private: \ hid_t Handle; \ diff --git a/IO/IOSS/vtkIOSSCellGridReaderInternal.cxx b/IO/IOSS/vtkIOSSCellGridReaderInternal.cxx index 39b8c81b12d..4c473ca08ec 100644 --- a/IO/IOSS/vtkIOSSCellGridReaderInternal.cxx +++ b/IO/IOSS/vtkIOSSCellGridReaderInternal.cxx @@ -288,7 +288,8 @@ std::vector<vtkSmartPointer<vtkCellGrid>> vtkIOSSCellGridReaderInternal::GetSide std::map<int, int> permutations; int firstSideIdx = -1; vtkSMPTools::For(0, sideArray->GetNumberOfTuples(), - [sideArray, cellIdOffset, &firstSideIdx, &permutations](vtkIdType begin, vtkIdType end) { + [sideArray, cellIdOffset, &firstSideIdx, &permutations](vtkIdType begin, vtkIdType end) + { std::array<vtkTypeUInt64, 2> sideTuple; for (vtkIdType mm = begin; mm < end; ++mm) { @@ -923,19 +924,21 @@ bool vtkIOSSCellGridReaderInternal::ApplyDisplacements(vtkCellGrid* grid, Ioss:: xformedPts->SetNumberOfComponents(3); xformedPts->SetNumberOfTuples(npts); double scale = this->DisplacementMagnitude; - vtkSMPTools::For(0, npts, [&](vtkIdType begin, vtkIdType end) { - vtkVector3d point{ 0.0 }, displ{ 0.0 }; - for (vtkIdType ii = begin; ii != end; ++ii) + vtkSMPTools::For(0, npts, + [&](vtkIdType begin, vtkIdType end) { - coords->GetTuple(ii, point.GetData()); - array->GetTuple(ii, displ.GetData()); - for (int jj = 0; jj < 3; ++jj) + vtkVector3d point{ 0.0 }, displ{ 0.0 }; + for (vtkIdType ii = begin; ii != end; ++ii) { - displ[jj] *= scale; + coords->GetTuple(ii, point.GetData()); + array->GetTuple(ii, displ.GetData()); + for (int jj = 0; jj < 3; ++jj) + { + displ[jj] *= scale; + } + xformedPts->SetTuple(ii, (point + displ).GetData()); } - xformedPts->SetTuple(ii, (point + displ).GetData()); - } - }); + }); auto* pointGroup = grid->GetAttributes("coordinates"_token); // Remove the undeflected points: pointGroup->RemoveArray(coords->GetName()); diff --git a/IO/IOSS/vtkIOSSFilesScanner.cxx b/IO/IOSS/vtkIOSSFilesScanner.cxx index cdb5787b413..46bc3148c9f 100644 --- a/IO/IOSS/vtkIOSSFilesScanner.cxx +++ b/IO/IOSS/vtkIOSSFilesScanner.cxx @@ -43,9 +43,9 @@ bool vtkIOSSFilesScanner::IsMetaFile(const std::string& filename) std::getline(metafile, s); rtrim(s); // strip trailing white-spaces if (s.empty() || - s.size() != static_cast<size_t>(std::count_if(s.begin(), s.end(), [](unsigned char c) { - return std::isprint(c) || std::isspace(c); - }))) + s.size() != + static_cast<size_t>(std::count_if( + s.begin(), s.end(), [](unsigned char c) { return std::isprint(c) || std::isspace(c); }))) { return false; } @@ -103,7 +103,8 @@ std::set<std::string> vtkIOSSFilesScanner::GetRelatedFiles( R"(^(.*\.cgns[^-.]*)(-s.[0-9]+)?(\.[0-9]+(\.[0-9]+)?)?$)"); // extract process count from the filename, if any, otherwise -1. - auto getProcessCount = [](const std::string& fname) { + auto getProcessCount = [](const std::string& fname) + { vtksys::RegularExpression procRegEx(R"(^.*\.([0-9]+)\.[0-9]+$)"); if (procRegEx.find(fname)) { @@ -241,9 +242,8 @@ bool vtkIOSSFilesScanner::DoTestFilePatternMatching() { auto verify = [](const std::set<std::string>& original, const std::vector<std::string>& dir_listing, - const std::set<std::string>& expected) { - return (vtkIOSSFilesScanner::GetRelatedFiles(original, dir_listing) == expected); - }; + const std::set<std::string>& expected) + { return (vtkIOSSFilesScanner::GetRelatedFiles(original, dir_listing) == expected); }; if (!verify({ "mysimoutput.e-s.000" }, { "mysimoutput.e-s.000", "mysimoutput.e-s.001", "mysimoutput.e-s.002" }, diff --git a/IO/IOSS/vtkIOSSModel.cxx b/IO/IOSS/vtkIOSSModel.cxx index 12491f67a79..041538e229c 100644 --- a/IO/IOSS/vtkIOSSModel.cxx +++ b/IO/IOSS/vtkIOSSModel.cxx @@ -274,13 +274,15 @@ ErrorHandleInformation HandleGlobalIds(vtkPartitionedDataSetCollection* pdc, int globalIds->SetName(VTK_IOSS_MODEL_GLOBAL_IDS_ARRAY_NAME); globalIds->SetNumberOfComponents(1); globalIds->SetNumberOfTuples(numberOfElements); - vtkSMPTools::For(0, numberOfElements, [&](vtkIdType begin, vtkIdType end) { - auto globalIdsPtr = globalIds->GetPointer(0); - for (vtkIdType j = begin; j < end; ++j) + vtkSMPTools::For(0, numberOfElements, + [&](vtkIdType begin, vtkIdType end) { - globalIdsPtr[j] = startId + j; - } - }); + auto globalIdsPtr = globalIds->GetPointer(0); + for (vtkIdType j = begin; j < end; ++j) + { + globalIdsPtr[j] = startId + j; + } + }); ds->GetAttributes(association)->SetGlobalIds(globalIds); startId += numberOfElements; } @@ -462,20 +464,23 @@ ErrorHandleInformation HandleElementSide(vtkPartitionedDataSetCollection* pdc, ds->GetCellData()->GetArray(VTK_IOSS_MODEL_OLD_ELEMENT_SIDE_ARRAY_NAME)); const auto numTuples = oldElementSide->GetNumberOfTuples(); std::atomic<int> localHasValidOldElementSide(true); - vtkSMPTools::For(0, numTuples, [&](vtkIdType begin, vtkIdType end) { - if (!localHasValidOldElementSide) + vtkSMPTools::For(0, numTuples, + [&](vtkIdType begin, vtkIdType end) { - return; - } - for (vtkIdType j = begin; j < end; ++j) - { - if (oldToNewGlobalIds.find(oldElementSide->GetValue(2 * j)) == oldToNewGlobalIds.end()) + if (!localHasValidOldElementSide) { - localHasValidOldElementSide = false; - break; + return; } - } - }); + for (vtkIdType j = begin; j < end; ++j) + { + if (oldToNewGlobalIds.find(oldElementSide->GetValue(2 * j)) == + oldToNewGlobalIds.end()) + { + localHasValidOldElementSide = false; + break; + } + } + }); if (!localHasValidOldElementSide) { hasValidOldElementSide &= localHasValidOldElementSide.load(); @@ -515,17 +520,19 @@ ErrorHandleInformation HandleElementSide(vtkPartitionedDataSetCollection* pdc, elementSide->SetNumberOfTuples(oldElementSide->GetNumberOfTuples()); const auto globalIdOffset = writer->GetOffsetGlobalIds(); const auto numTuples = oldElementSide->GetNumberOfTuples(); - vtkSMPTools::For(0, numTuples, [&](vtkIdType begin, vtkIdType end) { - int oldElementSideTuple[2]; - int elementSideTuple[2]; - for (vtkIdType j = begin; j < end; ++j) + vtkSMPTools::For(0, numTuples, + [&](vtkIdType begin, vtkIdType end) { - oldElementSide->GetTypedTuple(j, oldElementSideTuple); - elementSideTuple[0] = oldToNewGlobalIds[oldElementSideTuple[0]] + globalIdOffset; - elementSideTuple[1] = oldElementSideTuple[1]; - elementSide->SetTypedTuple(j, elementSideTuple); - } - }); + int oldElementSideTuple[2]; + int elementSideTuple[2]; + for (vtkIdType j = begin; j < end; ++j) + { + oldElementSide->GetTypedTuple(j, oldElementSideTuple); + elementSideTuple[0] = oldToNewGlobalIds[oldElementSideTuple[0]] + globalIdOffset; + elementSideTuple[1] = oldElementSideTuple[1]; + elementSide->SetTypedTuple(j, elementSideTuple); + } + }); ds->GetCellData()->AddArray(elementSide); } } @@ -625,14 +632,16 @@ std::map<unsigned char, int64_t> GetElementCounts( for (auto& ds : datasets) { - vtkSMPTools::For(0, ds->GetNumberOfCells(), [&](vtkIdType start, vtkIdType end) { - for (vtkIdType cc = start; cc < end; ++cc) + vtkSMPTools::For(0, ds->GetNumberOfCells(), + [&](vtkIdType start, vtkIdType end) { - // memory_order_relaxed is safe here, since we're not using the atomics for - // synchronization. - elementCounts[ds->GetCellType(cc)].fetch_add(1, std::memory_order_relaxed); - } - }); + for (vtkIdType cc = start; cc < end; ++cc) + { + // memory_order_relaxed is safe here, since we're not using the atomics for + // synchronization. + elementCounts[ds->GetCellType(cc)].fetch_add(1, std::memory_order_relaxed); + } + }); } // convert element counts to a map @@ -781,33 +790,35 @@ struct PutFieldWorker { using SourceT = vtk::GetAPIType<ArrayType>; vtkSMPThreadLocal<std::vector<SourceT>> tlTuple; - vtkSMPTools::For(0, this->SourceIds->size(), [&](vtkIdType start, vtkIdType end) { - auto tuple = tlTuple.Local(); - tuple.resize(this->NumComponents); - if (this->CreateAOS) + vtkSMPTools::For(0, this->SourceIds->size(), + [&](vtkIdType start, vtkIdType end) { - for (vtkIdType cc = start; cc < end; ++cc) + auto tuple = tlTuple.Local(); + tuple.resize(this->NumComponents); + if (this->CreateAOS) { - array->GetTypedTuple((*this->SourceIds)[cc], tuple.data()); - for (int comp = 0; comp < this->NumComponents; ++comp) + for (vtkIdType cc = start; cc < end; ++cc) { - this->AOSData[(this->Offset + cc) * this->NumComponents + comp] = - static_cast<T>(tuple[comp]); + array->GetTypedTuple((*this->SourceIds)[cc], tuple.data()); + for (int comp = 0; comp < this->NumComponents; ++comp) + { + this->AOSData[(this->Offset + cc) * this->NumComponents + comp] = + static_cast<T>(tuple[comp]); + } } } - } - else - { - for (vtkIdType cc = start; cc < end; ++cc) + else { - array->GetTypedTuple((*this->SourceIds)[cc], tuple.data()); - for (int comp = 0; comp < this->NumComponents; ++comp) + for (vtkIdType cc = start; cc < end; ++cc) { - this->SOAData[comp][this->Offset + cc] = static_cast<T>(tuple[comp]); + array->GetTypedTuple((*this->SourceIds)[cc], tuple.data()); + for (int comp = 0; comp < this->NumComponents; ++comp) + { + this->SOAData[comp][this->Offset + cc] = static_cast<T>(tuple[comp]); + } } } - } - }); + }); this->Offset += this->SourceIds->size(); } @@ -832,18 +843,20 @@ struct DisplacementWorker void operator()(ArrayType* array) { using SourceT = vtk::GetAPIType<ArrayType>; - vtkSMPTools::For(0, this->SourceIds->size(), [&](vtkIdType start, vtkIdType end) { - SourceT* displ = new SourceT[this->Data.size()]; - for (vtkIdType cc = start; cc < end; ++cc) + vtkSMPTools::For(0, this->SourceIds->size(), + [&](vtkIdType start, vtkIdType end) { - array->GetTypedTuple((*this->SourceIds)[cc], displ); - for (size_t comp = 0; comp < this->Data.size(); ++comp) + SourceT* displ = new SourceT[this->Data.size()]; + for (vtkIdType cc = start; cc < end; ++cc) { - this->Data[comp][this->Offset + cc] -= (displ[comp] * this->Magnitude); + array->GetTypedTuple((*this->SourceIds)[cc], displ); + for (size_t comp = 0; comp < this->Data.size(); ++comp) + { + this->Data[comp][this->Offset + cc] -= (displ[comp] * this->Magnitude); + } } - } - delete[] displ; - }); + delete[] displ; + }); this->Offset += this->SourceIds->size(); } @@ -1450,9 +1463,9 @@ struct vtkEntityBlock : public vtkGroupingEntity else { std::transform(orderingTransformation.begin(), orderingTransformation.end(), - std::back_inserter(connectivity), [&](int localId) { - return gidOffset + pointGIDs->GetValue(cellPoints[localId]); - }); + std::back_inserter(connectivity), + [&](int localId) + { return gidOffset + pointGIDs->GetValue(cellPoints[localId]); }); } } } @@ -2005,9 +2018,8 @@ vtkIOSSModel::vtkIOSSModel(vtkPartitionedDataSetCollection* pdc, vtkIOSSWriter* } // write the above for loop with one line const bool indicesEmpty = std::all_of(entityIndices.begin(), entityIndices.end(), - [](const std::pair<EntityType, std::set<unsigned int>>& indices) { - return indices.second.empty(); - }); + [](const std::pair<EntityType, std::set<unsigned int>>& indices) + { return indices.second.empty(); }); if (indicesEmpty) { // if no indices are specified, then all blocks will be processed as element blocks diff --git a/IO/IOSS/vtkIOSSReaderInternal.cxx b/IO/IOSS/vtkIOSSReaderInternal.cxx index 9dd49b3264f..dfd3294d59d 100644 --- a/IO/IOSS/vtkIOSSReaderInternal.cxx +++ b/IO/IOSS/vtkIOSSReaderInternal.cxx @@ -643,7 +643,8 @@ bool vtkIOSSReaderInternal::BuildAssembly( std::function<void(const Ioss::Assembly*, int)> processAssembly; processAssembly = [&assembly, &processAssembly, &add_leaves, this]( - const Ioss::Assembly* ioss_assembly, int parent) { + const Ioss::Assembly* ioss_assembly, int parent) + { auto node = assembly->AddNode( vtkDataAssembly::MakeValidNodeName(ioss_assembly->name().c_str()).c_str(), parent); assembly->SetAttribute(node, "label", ioss_assembly->name().c_str()); @@ -1833,9 +1834,9 @@ vtkSmartPointer<vtkAbstractArray> vtkIOSSReaderInternal::GetField(const std::str Ioss::Region* region, const Ioss::GroupingEntity* group_entity, const DatabaseHandle& handle, int timestep, vtkIdTypeArray* ids_to_extract, const std::string& cache_key_suffix) { - const auto get_field = - [&fieldname, ®ion, ×tep, &handle, this]( - const Ioss::GroupingEntity* entity) -> vtkSmartPointer<vtkAbstractArray> { + const auto get_field = [&fieldname, ®ion, ×tep, &handle, this]( + const Ioss::GroupingEntity* entity) -> vtkSmartPointer<vtkAbstractArray> + { if (!entity->field_exists(fieldname)) { return nullptr; @@ -1855,10 +1856,9 @@ vtkSmartPointer<vtkAbstractArray> vtkIOSSReaderInternal::GetField(const std::str return nullptr; } - auto iter = - std::find_if(stateVector.begin(), stateVector.end(), [&](const std::pair<int, double>& pair) { - return pair.second == this->TimestepValues[timestep]; - }); + auto iter = std::find_if(stateVector.begin(), stateVector.end(), + [&](const std::pair<int, double>& pair) + { return pair.second == this->TimestepValues[timestep]; }); if (iter == stateVector.end()) { @@ -1881,7 +1881,8 @@ vtkSmartPointer<vtkAbstractArray> vtkIOSSReaderInternal::GetField(const std::str } }; - const auto get_field_for_entity = [&]() { + const auto get_field_for_entity = [&]() + { if (group_entity->type() == Ioss::EntityType::SIDESET) { // sidesets need to be handled specially. For sidesets, the fields are diff --git a/IO/IOSS/vtkIOSSReaderInternal.h b/IO/IOSS/vtkIOSSReaderInternal.h index a808b9ac1f0..9ce64fef652 100644 --- a/IO/IOSS/vtkIOSSReaderInternal.h +++ b/IO/IOSS/vtkIOSSReaderInternal.h @@ -292,10 +292,9 @@ public: { return false; } - const bool allHandlesAreNew = - std::all_of(dbaseHandles.begin(), dbaseHandles.end(), [&](const DatabaseHandle& handle) { - return this->RegionMap.find(handle) == this->RegionMap.end(); - }); + const bool allHandlesAreNew = std::all_of(dbaseHandles.begin(), dbaseHandles.end(), + [&](const DatabaseHandle& handle) + { return this->RegionMap.find(handle) == this->RegionMap.end(); }); return !allHandlesAreNew; } diff --git a/IO/Image/vtkMRCReader.cxx b/IO/Image/vtkMRCReader.cxx index acf0314c93f..f4b3b01dcb9 100644 --- a/IO/Image/vtkMRCReader.cxx +++ b/IO/Image/vtkMRCReader.cxx @@ -23,7 +23,7 @@ #include <cassert> -//#define VTK_DEBUG_MRC_HEADER +// #define VTK_DEBUG_MRC_HEADER VTK_ABI_NAMESPACE_BEGIN namespace diff --git a/IO/Image/vtkOMETIFFReader.cxx b/IO/Image/vtkOMETIFFReader.cxx index 4c44b6d5b07..333e288dd2b 100644 --- a/IO/Image/vtkOMETIFFReader.cxx +++ b/IO/Image/vtkOMETIFFReader.cxx @@ -360,11 +360,13 @@ int vtkOMETIFFReader::RequestInformation( double start = 0.0; const double increment = omeinternals.TimeIncrement; - std::generate(timesteps.begin(), timesteps.end(), [&start, &increment]() { - double ret = start; - start += increment; - return ret; - }); + std::generate(timesteps.begin(), timesteps.end(), + [&start, &increment]() + { + double ret = start; + start += increment; + return ret; + }); outInfo->Set( vtkStreamingDemandDrivenPipeline::TIME_STEPS(), timesteps.data(), omeinternals.SizeT); diff --git a/IO/Image/vtkSEPReader.cxx b/IO/Image/vtkSEPReader.cxx index 3e096929fbc..5a0ef97c5c3 100644 --- a/IO/Image/vtkSEPReader.cxx +++ b/IO/Image/vtkSEPReader.cxx @@ -105,7 +105,8 @@ vtkSEPReader::vtkSEPReader() //---------------------------------------------------------------------------- void vtkSEPReader::PrintSelf(ostream& os, vtkIndent indent) { - const auto PrintDataType = [](const DataFormatType type) { + const auto PrintDataType = [](const DataFormatType type) + { switch (type) { case DataFormatType::XDR_DOUBLE: @@ -166,7 +167,8 @@ int vtkSEPReader::RequestInformation(vtkInformation* vtkNotUsed(request), this->FixedDimRange[1] = std::max(this->FixedDimRange[1], this->Dimensions[i]); } - const auto AssignDimensionId = [this](const std::string& Name) -> int { + const auto AssignDimensionId = [this](const std::string& Name) -> int + { auto iter = std::find(std::begin(this->Label), std::end(this->Label), Name); return std::distance(this->Label, iter); }; @@ -450,7 +452,8 @@ bool vtkSEPReader::ReadData(vtkImageData* imageData, int updateExtents[6]) acc *= this->Dimensions[t]; } - const auto GetConstantOffsetValue = [this](const int fixedValue, const int dimensionArrayId) { + const auto GetConstantOffsetValue = [this](const int fixedValue, const int dimensionArrayId) + { if (details::DimensionIsInRange(fixedValue)) { if (fixedValue >= dimensionArrayId) diff --git a/IO/Image/vtkTGAReader.cxx b/IO/Image/vtkTGAReader.cxx index 101ae7d193e..4d46fc365f6 100644 --- a/IO/Image/vtkTGAReader.cxx +++ b/IO/Image/vtkTGAReader.cxx @@ -98,7 +98,8 @@ void vtkTGAReader::ExecuteDataWithInformation(vtkDataObject* output, vtkInformat unsigned char* endPtr = outPtr + ((this->DataExtent[3] + 1) * (this->DataExtent[1] + 1) * nComponents); - auto GetColor = [&](size_t& currentIndex, unsigned char*& buffer) { + auto GetColor = [&](size_t& currentIndex, unsigned char*& buffer) + { for (vtkIdType j = 0; j < nComponents; j++) { buffer[j] = content[currentIndex + j]; diff --git a/IO/Legacy/vtkPolyDataReader.cxx b/IO/Legacy/vtkPolyDataReader.cxx index e373ae7a0d5..e35b3b18a7b 100644 --- a/IO/Legacy/vtkPolyDataReader.cxx +++ b/IO/Legacy/vtkPolyDataReader.cxx @@ -48,7 +48,8 @@ int vtkPolyDataReader::ReadMeshSimple(const std::string& fname, vtkDataObject* d vtkPolyData* output = vtkPolyData::SafeDownCast(doOutput); // Helper function to handle legacy cell data fallback: - auto readCellArray = [&](vtkSmartPointer<vtkCellArray>& cellArray) -> bool { + auto readCellArray = [&](vtkSmartPointer<vtkCellArray>& cellArray) -> bool + { if (this->FileMajorVersion >= 5) { // Cells are written as offsets + connectivity arrays: return this->ReadCells(cellArray) != 0; diff --git a/IO/MINC/vtkMINCImageReader.cxx b/IO/MINC/vtkMINCImageReader.cxx index 61fc728aa77..c24e6878c98 100644 --- a/IO/MINC/vtkMINCImageReader.cxx +++ b/IO/MINC/vtkMINCImageReader.cxx @@ -1312,7 +1312,7 @@ void vtkMINCImageReader::ExecuteDataWithInformation(vtkDataObject* output, vtkIn switch (fileType) { - vtkMINCImageReaderTemplateMacro(delete[]((VTK_TT*)buffer)); + vtkMINCImageReaderTemplateMacro(delete[] ((VTK_TT*)buffer)); } this->CloseNetCDFFile(ncid); diff --git a/IO/MPIParallel/vtkMPIMultiBlockPLOT3DReader.cxx b/IO/MPIParallel/vtkMPIMultiBlockPLOT3DReader.cxx index f39435ae463..2524f1d97b2 100644 --- a/IO/MPIParallel/vtkMPIMultiBlockPLOT3DReader.cxx +++ b/IO/MPIParallel/vtkMPIMultiBlockPLOT3DReader.cxx @@ -20,7 +20,10 @@ template <> \ struct mpi_type<ctype> \ { \ - static MPI_Datatype type() { return mpitype; } \ + static MPI_Datatype type() \ + { \ + return mpitype; \ + } \ }; VTK_ABI_NAMESPACE_BEGIN diff --git a/IO/MotionFX/Testing/Cxx/TestMotionFXCFGReader2Gears.cxx b/IO/MotionFX/Testing/Cxx/TestMotionFXCFGReader2Gears.cxx index ee153415623..7b479314cca 100644 --- a/IO/MotionFX/Testing/Cxx/TestMotionFXCFGReader2Gears.cxx +++ b/IO/MotionFX/Testing/Cxx/TestMotionFXCFGReader2Gears.cxx @@ -15,7 +15,8 @@ int TestMotionFXCFGReader2Gears(int argc, char* argv[]) { return impl::Test(argc, argv, "Data/MotionFX/2_gears/rotate_motion.cfg", - [](vtkRenderWindow*, vtkRenderer* renderer, vtkMotionFXCFGReader*) { + [](vtkRenderWindow*, vtkRenderer* renderer, vtkMotionFXCFGReader*) + { auto camera = renderer->GetActiveCamera(); camera->SetFocalPoint(0.09, -0.02, -0.13); camera->SetPosition(0.15, -0.37, 0.15); diff --git a/IO/MotionFX/Testing/Cxx/TestMotionFXCFGReaderClover.cxx b/IO/MotionFX/Testing/Cxx/TestMotionFXCFGReaderClover.cxx index 3140540a1e7..9978447987e 100644 --- a/IO/MotionFX/Testing/Cxx/TestMotionFXCFGReaderClover.cxx +++ b/IO/MotionFX/Testing/Cxx/TestMotionFXCFGReaderClover.cxx @@ -15,7 +15,8 @@ int TestMotionFXCFGReaderClover(int argc, char* argv[]) { return impl::Test(argc, argv, "Data/MotionFX/clover/clover_utm.cfg", - [](vtkRenderWindow*, vtkRenderer* renderer, vtkMotionFXCFGReader*) { + [](vtkRenderWindow*, vtkRenderer* renderer, vtkMotionFXCFGReader*) + { auto camera = renderer->GetActiveCamera(); camera->SetFocalPoint(1.1, 2.25, -0.75); camera->SetPosition(-16.0, 15.0, 13.0); diff --git a/IO/MotionFX/Testing/Cxx/TestMotionFXCFGReaderPlanetary.cxx b/IO/MotionFX/Testing/Cxx/TestMotionFXCFGReaderPlanetary.cxx index 667ae3a4fa1..adb1ab0d66d 100644 --- a/IO/MotionFX/Testing/Cxx/TestMotionFXCFGReaderPlanetary.cxx +++ b/IO/MotionFX/Testing/Cxx/TestMotionFXCFGReaderPlanetary.cxx @@ -15,7 +15,8 @@ int TestMotionFXCFGReaderPlanetary(int argc, char* argv[]) { return impl::Test(argc, argv, "Data/MotionFX/planetary/Planetary_prescribedCOMmotion.cfg", - [](vtkRenderWindow*, vtkRenderer* renderer, vtkMotionFXCFGReader*) { + [](vtkRenderWindow*, vtkRenderer* renderer, vtkMotionFXCFGReader*) + { auto camera = renderer->GetActiveCamera(); camera->SetFocalPoint(-412.84, 121.00, -304.88); camera->SetPosition(-412.17, 121.27, -305.32); diff --git a/IO/MotionFX/Testing/Cxx/TestMotionFXCFGReaderPositionFile.cxx b/IO/MotionFX/Testing/Cxx/TestMotionFXCFGReaderPositionFile.cxx index 0dd258207b1..2e25afd5b87 100644 --- a/IO/MotionFX/Testing/Cxx/TestMotionFXCFGReaderPositionFile.cxx +++ b/IO/MotionFX/Testing/Cxx/TestMotionFXCFGReaderPositionFile.cxx @@ -15,7 +15,8 @@ int TestMotionFXCFGReaderPositionFile(int argc, char* argv[]) { return impl::Test(argc, argv, "Data/MotionFX/position_file/generic_chain_input.cfg", - [](vtkRenderWindow*, vtkRenderer* renderer, vtkMotionFXCFGReader*) { + [](vtkRenderWindow*, vtkRenderer* renderer, vtkMotionFXCFGReader*) + { auto camera = renderer->GetActiveCamera(); camera->SetFocalPoint(0.09, -0.02, -0.13); camera->SetPosition(0.15, -0.37, 0.15); diff --git a/IO/MotionFX/vtkMotionFXCFGReader.cxx b/IO/MotionFX/vtkMotionFXCFGReader.cxx index 56ed2cd8bb0..d5e0b54624e 100644 --- a/IO/MotionFX/vtkMotionFXCFGReader.cxx +++ b/IO/MotionFX/vtkMotionFXCFGReader.cxx @@ -192,24 +192,26 @@ protected: VTK_ASSUME(darray->GetNumberOfComponents() == 3); using ValueType = vtk::GetAPIType<InputArrayType>; - vtkSMPTools::For(0, darray->GetNumberOfTuples(), [&](vtkIdType begin, vtkIdType end) { - auto drange = vtk::DataArrayTupleRange(darray, begin, end); - for (auto tuple : drange) + vtkSMPTools::For(0, darray->GetNumberOfTuples(), + [&](vtkIdType begin, vtkIdType end) { - vtkVector4<ValueType> in, out; - in[0] = tuple[0]; - in[1] = tuple[1]; - in[2] = tuple[2]; - in[3] = 1.0; - - this->Transform->MultiplyPoint(in.GetData(), out.GetData()); - - out[0] /= out[3]; - out[1] /= out[3]; - out[2] /= out[3]; - tuple.SetTuple(out.GetData()); - } - }); + auto drange = vtk::DataArrayTupleRange(darray, begin, end); + for (auto tuple : drange) + { + vtkVector4<ValueType> in, out; + in[0] = tuple[0]; + in[1] = tuple[1]; + in[2] = tuple[2]; + in[3] = 1.0; + + this->Transform->MultiplyPoint(in.GetData(), out.GetData()); + + out[0] /= out[3]; + out[1] /= out[3]; + out[2] /= out[3]; + tuple.SetTuple(out.GetData()); + } + }); } }; }; @@ -279,14 +281,16 @@ private: { using T = vtk::GetAPIType<InputArrayType>; - vtkSMPTools::For(0, darray->GetNumberOfTuples(), [&](vtkIdType begin, vtkIdType end) { - for (auto tuple : vtk::DataArrayTupleRange<3>(darray, begin, end)) + vtkSMPTools::For(0, darray->GetNumberOfTuples(), + [&](vtkIdType begin, vtkIdType end) { - tuple[0] += static_cast<T>(this->Displacement[0]); - tuple[1] += static_cast<T>(this->Displacement[1]); - tuple[2] += static_cast<T>(this->Displacement[2]); - } - }); + for (auto tuple : vtk::DataArrayTupleRange<3>(darray, begin, end)) + { + tuple[0] += static_cast<T>(this->Displacement[0]); + tuple[1] += static_cast<T>(this->Displacement[1]); + tuple[2] += static_cast<T>(this->Displacement[2]); + } + }); } }; }; @@ -1174,9 +1178,8 @@ struct action<MotionFX::CFG::Grammar> { std::sort(apair.second.begin(), apair.second.end(), [](const std::shared_ptr<const impl::Motion>& m0, - const std::shared_ptr<const impl::Motion>& m1) { - return m0->tstart_prescribe < m1->tstart_prescribe; - }); + const std::shared_ptr<const impl::Motion>& m1) + { return m0->tstart_prescribe < m1->tstart_prescribe; }); } } }; diff --git a/IO/MySQL/vtkMySQLQuery.cxx b/IO/MySQL/vtkMySQLQuery.cxx index 38a9ec9ceec..19717b524cc 100644 --- a/IO/MySQL/vtkMySQLQuery.cxx +++ b/IO/MySQL/vtkMySQLQuery.cxx @@ -112,7 +112,10 @@ MYSQL_BIND BuildNullParameterStruct() //------------------------------------------------------------------------------ #define VTK_MYSQL_TYPENAME_MACRO(type, return_type) \ - enum enum_field_types vtkMySQLTypeName(type) { return return_type; } + enum enum_field_types vtkMySQLTypeName(type) \ + { \ + return return_type; \ + } VTK_MYSQL_TYPENAME_MACRO(signed char, MYSQL_TYPE_TINY); VTK_MYSQL_TYPENAME_MACRO(unsigned char, MYSQL_TYPE_TINY); diff --git a/IO/NetCDF/vtkSLACReader.cxx b/IO/NetCDF/vtkSLACReader.cxx index 95110e021ef..7f25fef2a7c 100644 --- a/IO/NetCDF/vtkSLACReader.cxx +++ b/IO/NetCDF/vtkSLACReader.cxx @@ -70,11 +70,11 @@ //------------------------------------------------------------------------------ #ifdef VTK_USE_64BIT_IDS -//#ifdef NC_INT64 +// #ifdef NC_INT64 //// This may or may not work with the netCDF 4 library reading in netCDF 3 files. -//#define nc_get_var_vtkIdType nc_get_var_longlong -//#define nc_get_vars_vtkIdType nc_get_vars_longlong -//#else // NC_INT64 +// #define nc_get_var_vtkIdType nc_get_var_longlong +// #define nc_get_vars_vtkIdType nc_get_vars_longlong +// #else // NC_INT64 VTK_ABI_NAMESPACE_BEGIN static int nc_get_var_vtkIdType(int ncid, int varid, vtkIdType* ip) { @@ -135,7 +135,7 @@ static int nc_get_vars_vtkIdType(int ncid, int varid, const size_t start[], cons return NC_NOERR; } VTK_ABI_NAMESPACE_END -//#endif // NC_INT64 +// #endif // NC_INT64 #else // VTK_USE_64_BIT_IDS #define nc_get_var_vtkIdType nc_get_var_int #define nc_get_vars_vtkIdType nc_get_vars_int diff --git a/IO/OpenVDB/vtkOpenVDBReader.cxx b/IO/OpenVDB/vtkOpenVDBReader.cxx index 2c0720906f1..328667894cb 100644 --- a/IO/OpenVDB/vtkOpenVDBReader.cxx +++ b/IO/OpenVDB/vtkOpenVDBReader.cxx @@ -319,8 +319,9 @@ struct PopulateImageDataArray const int maxSubIdx = imgDims[0] * imgDims[1]; const int maxIdx = maxSubIdx * imgDims[2]; - vtkSMPTools::For( - 0, maxIdx, [this, maxSubIdx, &imgDims, grid, dataArray](vtkIdType idx, vtkIdType endIdx) { + vtkSMPTools::For(0, maxIdx, + [this, maxSubIdx, &imgDims, grid, dataArray](vtkIdType idx, vtkIdType endIdx) + { typename GridType::Accessor accessor = grid->getAccessor(); float downsamplingFactor = this->dataInfo->DownsamplingFactor; diff --git a/IO/ParallelExodus/vtkPExodusIIReader.cxx b/IO/ParallelExodus/vtkPExodusIIReader.cxx index f8be5a66322..afb6dd3c607 100644 --- a/IO/ParallelExodus/vtkPExodusIIReader.cxx +++ b/IO/ParallelExodus/vtkPExodusIIReader.cxx @@ -636,7 +636,7 @@ int vtkPExodusIIReader::RequestData(vtkInformation* vtkNotUsed(request), append->AddInput( subgrid ); subgrid->Delete(); } -#else // 0 +#else // 0 append->AddInputConnection(this->ReaderList[reader_idx]->GetOutputPort()); #endif // 0 } diff --git a/IO/ParallelNetCDF/vtkPSLACReader.cxx b/IO/ParallelNetCDF/vtkPSLACReader.cxx index ac3ea5cfdf4..cb4c53977c6 100644 --- a/IO/ParallelNetCDF/vtkPSLACReader.cxx +++ b/IO/ParallelNetCDF/vtkPSLACReader.cxx @@ -61,10 +61,10 @@ } while (false) #ifdef VTK_USE_64BIT_IDS -//#ifdef NC_INT64 +// #ifdef NC_INT64 //// This may or may not work with the netCDF 4 library reading in netCDF 3 files. -//#define nc_get_vars_vtkIdType nc_get_vars_longlong -//#else // NC_INT64 +// #define nc_get_vars_vtkIdType nc_get_vars_longlong +// #else // NC_INT64 VTK_ABI_NAMESPACE_BEGIN static int nc_get_vars_vtkIdType(int ncid, int varid, const size_t start[], const size_t count[], const ptrdiff_t stride[], vtkIdType* ip) @@ -95,7 +95,7 @@ static int nc_get_vars_vtkIdType(int ncid, int varid, const size_t start[], cons return NC_NOERR; } VTK_ABI_NAMESPACE_END -//#endif // NC_INT64 +// #endif // NC_INT64 #else // VTK_USE_64_BIT_IDS #define nc_get_vars_vtkIdType nc_get_vars_int #endif // VTK_USE_64BIT_IDS diff --git a/IO/PostgreSQL/vtkPostgreSQLQuery.cxx b/IO/PostgreSQL/vtkPostgreSQLQuery.cxx index 0dd1b6b13d7..35c907cb9b4 100644 --- a/IO/PostgreSQL/vtkPostgreSQLQuery.cxx +++ b/IO/PostgreSQL/vtkPostgreSQLQuery.cxx @@ -799,7 +799,8 @@ vtkVariant ConvertStringToFloat(bool isBinary, const char* rawData) // This is the idiom that libpq uses internally to convert between the // two types. - union { + union + { unsigned int i; float f; } swap; @@ -898,7 +899,8 @@ vtkVariant ConvertStringToDouble(bool isBinary, const char* rawData) // Let's hope that we always have a 64-bit type. vtkTypeUInt64 intResult = 0; ConvertFromNetworkOrder(intResult, rawData); - union { + union + { vtkTypeUInt64 i; double d; } swap; diff --git a/IO/Video/vtkWin32VideoSource.cxx b/IO/Video/vtkWin32VideoSource.cxx index 735193ddde3..602a0964f3d 100644 --- a/IO/Video/vtkWin32VideoSource.cxx +++ b/IO/Video/vtkWin32VideoSource.cxx @@ -66,7 +66,7 @@ vtkWin32VideoSource::~vtkWin32VideoSource() { this->vtkWin32VideoSource::ReleaseSystemResources(); - delete[](char*)(this->Internal->BitMapPtr); + delete[] (char*)(this->Internal->BitMapPtr); this->Internal->BitMapPtr = nullptr; this->BitMapSize = 0; delete this->Internal; @@ -1025,7 +1025,7 @@ void vtkWin32VideoSource::DoVFWFormatCheck() int formatSize = capGetVideoFormatSize(this->Internal->CapWnd); if (formatSize > this->BitMapSize) { - delete[]((char*)this->Internal->BitMapPtr); + delete[] ((char*)this->Internal->BitMapPtr); this->Internal->BitMapPtr = (LPBITMAPINFO) new char[formatSize]; this->BitMapSize = formatSize; } @@ -1111,7 +1111,7 @@ void vtkWin32VideoSource::DoVFWFormatSetup() int formatSize = capGetVideoFormatSize(this->Internal->CapWnd); if (formatSize > this->BitMapSize) { - delete[]((char*)this->Internal->BitMapPtr); + delete[] ((char*)this->Internal->BitMapPtr); this->Internal->BitMapPtr = (LPBITMAPINFO) new char[formatSize]; this->BitMapSize = formatSize; } diff --git a/IO/Xdmf2/vtkXdmfWriter.cxx b/IO/Xdmf2/vtkXdmfWriter.cxx index a2b5bce4c8e..57ec03ea764 100644 --- a/IO/Xdmf2/vtkXdmfWriter.cxx +++ b/IO/Xdmf2/vtkXdmfWriter.cxx @@ -814,9 +814,8 @@ int vtkXdmfWriter::CreateTopology(vtkDataSet* ds, xdmf2::XdmfGrid* grid, vtkIdTy da->SetNumberOfComponents(1); vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast(ds); const int ESTIMATE = 4; /*celltype+numids+id0+id1 or celtype+id0+id1+id2*/ - auto countConnSize = [](vtkCellArray* ca) { - return ca->GetNumberOfCells() + ca->GetNumberOfConnectivityIds(); - }; + auto countConnSize = [](vtkCellArray* ca) + { return ca->GetNumberOfCells() + ca->GetNumberOfConnectivityIds(); }; if (ugrid) { da->Allocate(countConnSize(ugrid->GetCells()) * ESTIMATE); diff --git a/IO/Xdmf3/vtkXdmf3ArraySelection.h b/IO/Xdmf3/vtkXdmf3ArraySelection.h index 60bb8a57029..8b902484c51 100644 --- a/IO/Xdmf3/vtkXdmf3ArraySelection.h +++ b/IO/Xdmf3/vtkXdmf3ArraySelection.h @@ -71,5 +71,5 @@ public: #endif VTK_ABI_NAMESPACE_END -#endif //# vtkXdmf3ArraySelection_h +#endif // # vtkXdmf3ArraySelection_h // VTK-HeaderTest-Exclude: vtkXdmf3ArraySelection.h diff --git a/Imaging/Core/Testing/Cxx/TestImageSSIM.cxx b/Imaging/Core/Testing/Cxx/TestImageSSIM.cxx index 3e0af41bc52..765da52cc52 100644 --- a/Imaging/Core/Testing/Cxx/TestImageSSIM.cxx +++ b/Imaging/Core/Testing/Cxx/TestImageSSIM.cxx @@ -13,7 +13,8 @@ int TestImageSSIM(int argc, char* argv[]) { - auto createPipeline = [](std::string&& name) { + auto createPipeline = [](std::string&& name) + { vtkNew<vtkPNGReader> reader; reader->SetFileName(name.c_str()); diff --git a/Imaging/Core/vtkImageInterpolatorInternals.h b/Imaging/Core/vtkImageInterpolatorInternals.h index 5af96f82883..7d32463aa83 100644 --- a/Imaging/Core/vtkImageInterpolatorInternals.h +++ b/Imaging/Core/vtkImageInterpolatorInternals.h @@ -121,7 +121,8 @@ inline int vtkInterpolationMath::Floor(double x, F& f) return static_cast<int>(i - 103079215104LL); #elif !defined VTK_WORDS_BIGENDIAN // same as above, but avoid doing any 64-bit integer arithmetic - union { + union + { double d; unsigned short s[4]; unsigned int i[2]; @@ -131,7 +132,8 @@ inline int vtkInterpolationMath::Floor(double x, F& f) return static_cast<int>((dual.i[1] << 16) | ((dual.i[0]) >> 16)); #else // and again for big-endian architectures - union { + union + { double d; unsigned short s[4]; unsigned int i[2]; @@ -151,7 +153,8 @@ inline int vtkInterpolationMath::Round(double x) return static_cast<int>(i - 103079215104LL); #elif !defined VTK_WORDS_BIGENDIAN // same as above, but avoid doing any 64-bit integer arithmetic - union { + union + { double d; unsigned int i[2]; } dual; @@ -159,7 +162,8 @@ inline int vtkInterpolationMath::Round(double x) return static_cast<int>((dual.i[1] << 16) | ((dual.i[0]) >> 16)); #else // and again for big-endian architectures - union { + union + { double d; unsigned int i[2]; } dual; diff --git a/Imaging/Core/vtkImageResize.cxx b/Imaging/Core/vtkImageResize.cxx index 3faab8a17a9..e714d037f51 100644 --- a/Imaging/Core/vtkImageResize.cxx +++ b/Imaging/Core/vtkImageResize.cxx @@ -336,7 +336,10 @@ namespace } #define VTK_RESIZE_CONVERT_FLOAT(T) \ - void vtkImageResizeConvert(double v, T& u) { u = static_cast<T>(v); } + void vtkImageResizeConvert(double v, T& u) \ + { \ + u = static_cast<T>(v); \ + } VTK_RESIZE_CONVERT_INT_CLAMP(vtkTypeUInt8, 0.0, 255.0); VTK_RESIZE_CONVERT_INT_CLAMP(vtkTypeUInt16, 0.0, 65535.0); diff --git a/Imaging/Core/vtkImageReslice.cxx b/Imaging/Core/vtkImageReslice.cxx index f212027b969..63b08eaef57 100644 --- a/Imaging/Core/vtkImageReslice.cxx +++ b/Imaging/Core/vtkImageReslice.cxx @@ -1953,7 +1953,7 @@ void vtkImageResliceExecute(vtkImageReslice* self, vtkDataArray* scalars, { void (*convertpixels)(void*& out, const F* in, int numscalars, int n) = nullptr; void (*setpixels)(void*& out, const void* in, int numscalars, int n) = nullptr; - void (*composite)(F * in, int numscalars, int n) = nullptr; + void (*composite)(F* in, int numscalars, int n) = nullptr; // get the input stencil vtkImageStencilData* stencil = self->GetStencil(); @@ -2821,7 +2821,7 @@ void vtkReslicePermuteExecute(vtkImageReslice* self, vtkDataArray* scalars, vtkGetSetPixelsFunc(&setpixels, scalarType, outComponents); // get the slab compositing function - void (*composite)(F * op, const F* ip, int nc, int count, int i, int n) = nullptr; + void (*composite)(F* op, const F* ip, int nc, int count, int i, int n) = nullptr; vtkGetRowCompositeFunc(&composite, self->GetSlabMode(), self->GetSlabTrapezoidIntegration()); // get temp float space for type conversion diff --git a/Imaging/Core/vtkImageSSIM.cxx b/Imaging/Core/vtkImageSSIM.cxx index 771d57e15a1..6f8ba9a079f 100644 --- a/Imaging/Core/vtkImageSSIM.cxx +++ b/Imaging/Core/vtkImageSSIM.cxx @@ -44,7 +44,8 @@ struct SSIMWorker const int* e1 = im1->GetExtent(); const int* e2 = im2->GetExtent(); - auto inBounds = [&e1, &e2](int i, int j, int k) { + auto inBounds = [&e1, &e2](int i, int j, int k) + { return i >= e1[0] && j >= e1[2] && k >= e1[4] && i >= e2[0] && j >= e2[2] && k >= e2[4] && i <= e1[1] && j <= e1[3] && k <= e1[5] && i <= e2[1] && j <= e2[3] && k <= e2[5]; }; @@ -59,7 +60,8 @@ struct SSIMWorker int d[3], dijk[3]; double squaredRadius = radius * radius; - auto inPatch = [&ijk, &dijk, &d, &squaredRadius] { + auto inPatch = [&ijk, &dijk, &d, &squaredRadius] + { vtkMath::Subtract(ijk, dijk, d); return vtkMath::SquaredNorm(d) <= squaredRadius; }; @@ -83,7 +85,8 @@ struct SSIMWorker double totalWeights = 0.0; auto smooth = [&sigma2](double x2) { return std::exp(-x2 / (2 * sigma2)); }; - auto coordToNorm2 = [&](const int v[3]) { + auto coordToNorm2 = [&](const int v[3]) + { int x = v[0] - (imax + imin) * 0.5; int y = v[1] - (jmax + jmin) * 0.5; int z = v[2] - (kmax + kmin) * 0.5; @@ -535,9 +538,8 @@ int vtkImageSSIM::RequestInformation(vtkInformation* vtkNotUsed(request), //------------------------------------------------------------------------------ void vtkImageSSIM::ComputeErrorMetrics(vtkDoubleArray* scalars, double& tight, double& loose) { - auto arrayMax = [](const std::array<double, 3>& v) { - return std::max(std::max(v[0], v[1]), v[2]); - }; + auto arrayMax = [](const std::array<double, 3>& v) + { return std::max(std::max(v[0], v[1]), v[2]); }; auto mink1 = ComputeMinkowski1(scalars); auto mink2 = ComputeMinkowski2(scalars); diff --git a/Imaging/Hybrid/vtkSurfaceReconstructionFilter.cxx b/Imaging/Hybrid/vtkSurfaceReconstructionFilter.cxx index 9598aa62453..ebb9ba9805c 100644 --- a/Imaging/Hybrid/vtkSurfaceReconstructionFilter.cxx +++ b/Imaging/Hybrid/vtkSurfaceReconstructionFilter.cxx @@ -562,7 +562,7 @@ static double** vtkSRMatrix(long nrl, long nrh, long ncl, long nch) // free a double vector allocated with SRVector() static void vtkSRFreeVector(double* v, long nl, long vtkNotUsed(nh)) { - delete[](v + nl - VTK_NR_END); + delete[] (v + nl - VTK_NR_END); } // free a double matrix allocated by Matrix() @@ -570,8 +570,8 @@ static void vtkSRFreeMatrix( double** m, long nrl, long vtkNotUsed(nrh), long ncl, long vtkNotUsed(nch)) { - delete[](m[nrl] + ncl - VTK_NR_END); - delete[](m + nrl - VTK_NR_END); + delete[] (m[nrl] + ncl - VTK_NR_END); + delete[] (m + nrl - VTK_NR_END); } #undef VTK_NR_END diff --git a/Infovis/Core/Testing/Cxx/TestTableToGraph.cxx b/Infovis/Core/Testing/Cxx/TestTableToGraph.cxx index 6e5d837b863..4187aaf723d 100644 --- a/Infovis/Core/Testing/Cxx/TestTableToGraph.cxx +++ b/Infovis/Core/Testing/Cxx/TestTableToGraph.cxx @@ -38,7 +38,7 @@ // Uncomment the following line to show Qt tables of // the vertex and edge tables. -//#define SHOW_QT_DATA_TABLES 1 +// #define SHOW_QT_DATA_TABLES 1 #ifdef SHOW_QT_DATA_TABLES #include "vtkQtTableView.h" diff --git a/Infovis/Core/vtkWordCloud.cxx b/Infovis/Core/vtkWordCloud.cxx index ba6036b763e..747024f9091 100644 --- a/Infovis/Core/vtkWordCloud.cxx +++ b/Infovis/Core/vtkWordCloud.cxx @@ -460,8 +460,9 @@ std::multiset<std::pair<std::string, int>, Comparator> FindWordsSortedByFrequenc // Defining a lambda function to compare two pairs. It will compare // two pairs using second field - Comparator compFunctor = [](const std::pair<std::string, int>& elem1, - const std::pair<std::string, int>& elem2) { + Comparator compFunctor = + [](const std::pair<std::string, int>& elem1, const std::pair<std::string, int>& elem2) + { if (elem1.second == elem2.second) { return elem1.first.length() > elem2.first.length(); diff --git a/Interaction/Widgets/Testing/Cxx/TestSphereHandleWidget.cxx b/Interaction/Widgets/Testing/Cxx/TestSphereHandleWidget.cxx index 65392ca5a1f..9e8d7b71255 100644 --- a/Interaction/Widgets/Testing/Cxx/TestSphereHandleWidget.cxx +++ b/Interaction/Widgets/Testing/Cxx/TestSphereHandleWidget.cxx @@ -218,7 +218,7 @@ const char TestSphereHandleWidgetEventLog[] = "# StreamVersion 1\n" "MouseMoveEvent 272 170 0 0 0 0 0\n" "MouseMoveEvent 271 170 0 0 0 0 0\n"; -//#define RECORD +// #define RECORD int TestSphereHandleWidget(int argc, char* argv[]) { diff --git a/Interaction/Widgets/vtkImplicitAnnulusRepresentation.cxx b/Interaction/Widgets/vtkImplicitAnnulusRepresentation.cxx index 6847d6b30ad..a83ea082045 100644 --- a/Interaction/Widgets/vtkImplicitAnnulusRepresentation.cxx +++ b/Interaction/Widgets/vtkImplicitAnnulusRepresentation.cxx @@ -67,7 +67,8 @@ double ComputeDeltaRadius( //------------------------------------------------------------------------------ vtkImplicitAnnulusRepresentation::vtkImplicitAnnulusRepresentation() { - auto initializeRadiusRepresentation = [](RadiusHandleRepresentation& representation) { + auto initializeRadiusRepresentation = [](RadiusHandleRepresentation& representation) + { vtkNew<vtkPoints> points; points->SetDataTypeToDouble(); representation.PolyData->SetPoints(points); @@ -84,7 +85,8 @@ vtkImplicitAnnulusRepresentation::vtkImplicitAnnulusRepresentation() representation.Mapper->ScalarVisibilityOff(); }; - auto initializeAxisRepresentation = [](AxisHandleRepresentation& representation) { + auto initializeAxisRepresentation = [](AxisHandleRepresentation& representation) + { // Create the axis representation.LineSource->SetResolution(1); representation.LineMapper->SetInputConnection(representation.LineSource->GetOutputPort()); @@ -1376,7 +1378,8 @@ void vtkImplicitAnnulusRepresentation::BuildAnnulus() vtkPoints* annulusPoints = this->AnnulusPD->GetPoints(); annulusPoints->SetNumberOfPoints(numberOfPointsPerCylinder * 2.); - auto createPoints = [&](vtkIdType idx, const CylinderInfo& cylinder) { + auto createPoints = [&](vtkIdType idx, const CylinderInfo& cylinder) + { vtkVector3d topPoint(cylinder.Radius, height, 0.); toYAlignedAnnulus->TransformPoint(topPoint.GetData(), topPoint.GetData()); toWidgetBasis->TransformPoint(topPoint.GetData(), topPoint.GetData()); @@ -1402,7 +1405,8 @@ void vtkImplicitAnnulusRepresentation::BuildAnnulus() vtkVector3d boundsCenter; bbox.GetCenter(boundsCenter.GetData()); - auto clampPointsToBoundingBox = [&](CylinderInfo& cylinder) { + auto clampPointsToBoundingBox = [&](CylinderInfo& cylinder) + { for (vtkIdType pointIdx = 0; pointIdx < numberOfPointsPerCylinderSide; ++pointIdx) { vtkVector3d bottomPoint, topPoint; @@ -1432,7 +1436,8 @@ void vtkImplicitAnnulusRepresentation::BuildAnnulus() // Create annulus polys vtkCellArray* polys = this->AnnulusPD->GetPolys(); - auto buildCylinderPolys = [&](const CylinderInfo& cylinder, vtkPolyData* edgesPD) { + auto buildCylinderPolys = [&](const CylinderInfo& cylinder, vtkPolyData* edgesPD) + { // Copy cylinder points to edge polydata edgesPD->Reset(); vtkPoints* edgePoints = edgesPD->GetPoints(); diff --git a/Parallel/Core/Testing/Cxx/TestThreadedCallbackQueue.cxx b/Parallel/Core/Testing/Cxx/TestThreadedCallbackQueue.cxx index 656bcdae41f..afe680d28da 100644 --- a/Parallel/Core/Testing/Cxx/TestThreadedCallbackQueue.cxx +++ b/Parallel/Core/Testing/Cxx/TestThreadedCallbackQueue.cxx @@ -33,7 +33,8 @@ void RunThreads(int nthreadsBegin, int nthreadsEnd) { vtkSmartPointer<vtkIntArray> array = vtkSmartPointer<vtkIntArray>::New(); queue->Push( - [&count](const int& n, const double&&, char, vtkIntArray* a1, vtkIntArray* a2) { + [&count](const int& n, const double&&, char, vtkIntArray* a1, vtkIntArray* a2) + { a1->SetName(std::to_string(n).c_str()); a2->SetName(std::to_string(n).c_str()); ++count; @@ -54,8 +55,7 @@ void RunThreads(int nthreadsBegin, int nthreadsEnd) struct A { A() { vtkLog(INFO, "Constructor"); } - A(A&& other) - noexcept + A(A&& other) noexcept : array(std::move(other.array)) , val(other.val) { @@ -118,7 +118,7 @@ bool TestFunctionTypeCompleteness() queue->Push(&::A::f, std::unique_ptr<A>(new ::A()), ::A(), ::A()); // Passing a std::function - std::function<void(::A&, ::A &&)> func = f; + std::function<void(::A&, ::A&&)> func = f; queue->Push(func, ::A(), ::A()); // Testing lvalue reference return type behavior @@ -145,7 +145,8 @@ bool TestSharedFutures() std::atomic_int count(0); std::mutex mutex; - auto f = [&count, &mutex](std::string& s, int low) { + auto f = [&count, &mutex](std::string& s, int low) + { std::unique_lock<std::mutex> lock(mutex); if (count++ < low) { diff --git a/Parallel/Core/Testing/Cxx/TestThreadedTaskQueue.cxx b/Parallel/Core/Testing/Cxx/TestThreadedTaskQueue.cxx index 8accbc19a8e..41733f22dbc 100644 --- a/Parallel/Core/Testing/Cxx/TestThreadedTaskQueue.cxx +++ b/Parallel/Core/Testing/Cxx/TestThreadedTaskQueue.cxx @@ -8,7 +8,8 @@ int TestThreadedTaskQueue(int, char*[]) { vtkThreadedTaskQueue<double, int, double> queue( - [](int i, double v) { + [](int i, double v) + { vtkLogF(INFO, "hey: %d, %f", i, v); return i * v; }, diff --git a/Parallel/Core/vtkCommunicator.cxx b/Parallel/Core/vtkCommunicator.cxx index ec5a44a14f8..83ef2c38cdf 100644 --- a/Parallel/Core/vtkCommunicator.cxx +++ b/Parallel/Core/vtkCommunicator.cxx @@ -55,7 +55,10 @@ reinterpret_cast<const VTK_TT*>(A), reinterpret_cast<VTK_TT*>(B), length)); \ } \ } \ - int Commutative() override { return 1; } \ + int Commutative() override \ + { \ + return 1; \ + } \ }; #define STANDARD_OPERATION_FLOAT_OVERRIDE(name) \ diff --git a/Parallel/Core/vtkSocketCommunicator.cxx b/Parallel/Core/vtkSocketCommunicator.cxx index 9077e414e79..b2f3ac859bf 100644 --- a/Parallel/Core/vtkSocketCommunicator.cxx +++ b/Parallel/Core/vtkSocketCommunicator.cxx @@ -20,7 +20,7 @@ // Uncomment the following line to help with debugging. When // ENABLE_SYNCHRONIZED_COMMUNICATION is defined, every Send() blocks until the // receive is successful. -//#define ENABLE_SYNCHRONIZED_COMMUNICATION +// #define ENABLE_SYNCHRONIZED_COMMUNICATION VTK_ABI_NAMESPACE_BEGIN class vtkSocketCommunicator::vtkMessageBuffer diff --git a/Parallel/DIY/Testing/Cxx/TestDIYUtilities.cxx b/Parallel/DIY/Testing/Cxx/TestDIYUtilities.cxx index 13ef758b386..39dd88af4ac 100644 --- a/Parallel/DIY/Testing/Cxx/TestDIYUtilities.cxx +++ b/Parallel/DIY/Testing/Cxx/TestDIYUtilities.cxx @@ -106,34 +106,36 @@ bool TestFieldDataExchange(vtkMultiProcessController* controller, int nComponent /*dim*/ 1, diy::interval(0, assigner.nblocks() - 1), assigner.nblocks()); decomposer.decompose(comm.rank(), assigner, master); - diy::all_to_all(master, assigner, [&fd](FieldDataBlock* block, const diy::ReduceProxy& srp) { - int myBlockId = srp.gid(); - if (srp.round() == 0) + diy::all_to_all(master, assigner, + [&fd](FieldDataBlock* block, const diy::ReduceProxy& srp) { - for (int i = 0; i < srp.out_link().size(); ++i) + int myBlockId = srp.gid(); + if (srp.round() == 0) { - const diy::BlockID& blockId = srp.out_link().target(i); - if (blockId.gid != myBlockId) + for (int i = 0; i < srp.out_link().size(); ++i) { - srp.enqueue<vtkFieldData*>(blockId, fd); + const diy::BlockID& blockId = srp.out_link().target(i); + if (blockId.gid != myBlockId) + { + srp.enqueue<vtkFieldData*>(blockId, fd); + } } } - } - else - { - for (int i = 0; i < static_cast<int>(srp.in_link().size()); ++i) + else { - const diy::BlockID& blockId = srp.in_link().target(i); - if (blockId.gid != myBlockId) + for (int i = 0; i < static_cast<int>(srp.in_link().size()); ++i) { - vtkFieldData* tmp = nullptr; - srp.dequeue(blockId, tmp); - block->FieldData.insert({ blockId.gid, tmp }); - tmp->FastDelete(); + const diy::BlockID& blockId = srp.in_link().target(i); + if (blockId.gid != myBlockId) + { + vtkFieldData* tmp = nullptr; + srp.dequeue(blockId, tmp); + block->FieldData.insert({ blockId.gid, tmp }); + tmp->FastDelete(); + } } } - } - }); + }); if (rank > 1) { diff --git a/Parallel/DIY/vtkDIYDataExchanger.cxx b/Parallel/DIY/vtkDIYDataExchanger.cxx index 04cfbc6bc76..343f81a2d41 100644 --- a/Parallel/DIY/vtkDIYDataExchanger.cxx +++ b/Parallel/DIY/vtkDIYDataExchanger.cxx @@ -109,26 +109,29 @@ bool vtkDIYDataExchanger::AllToAll(const std::vector<vtkSmartPointer<vtkDataSet> } master.add(/*gid=*/comm.rank(), block, link); - master.foreach ([](BlockT* b, const diy::Master::ProxyWithLink& cp) { - for (const auto& neighbor : cp.link()->neighbors()) + master.foreach ( + [](BlockT* b, const diy::Master::ProxyWithLink& cp) { - if (neighbor.gid == cp.gid()) - { - continue; - } // don't enqueue for self - auto& vector_of_ds = (*b)[neighbor.gid]; - // cp.enqueue(neighbor, static_cast<int>(vector_of_ds.size())); - for (auto& ds : vector_of_ds) + for (const auto& neighbor : cp.link()->neighbors()) { - vtkLogF(TRACE, "enqueue for %d (%p)", neighbor.gid, static_cast<void*>(ds.GetPointer())); - cp.enqueue<vtkDataSet*>(neighbor, ds.GetPointer()); + if (neighbor.gid == cp.gid()) + { + continue; + } // don't enqueue for self + auto& vector_of_ds = (*b)[neighbor.gid]; + // cp.enqueue(neighbor, static_cast<int>(vector_of_ds.size())); + for (auto& ds : vector_of_ds) + { + vtkLogF(TRACE, "enqueue for %d (%p)", neighbor.gid, static_cast<void*>(ds.GetPointer())); + cp.enqueue<vtkDataSet*>(neighbor, ds.GetPointer()); + } + vector_of_ds.clear(); } - vector_of_ds.clear(); - } - }); + }); master.exchange(); master.foreach ( - [&offsets, &sendBuffer, &sendCounts](BlockT* b, const diy::Master::ProxyWithLink& cp) { + [&offsets, &sendBuffer, &sendCounts](BlockT* b, const diy::Master::ProxyWithLink& cp) + { for (const auto& neighbor : cp.link()->neighbors()) { auto& vector_of_ds = (*b)[neighbor.gid]; diff --git a/Parallel/DIY/vtkDIYGhostUtilities.txx b/Parallel/DIY/vtkDIYGhostUtilities.txx index 21f4b872b52..50df142d3c7 100644 --- a/Parallel/DIY/vtkDIYGhostUtilities.txx +++ b/Parallel/DIY/vtkDIYGhostUtilities.txx @@ -214,7 +214,8 @@ unsigned char CleanGhostsReduceAllForStructuredData( unsigned char cleanGhostMask = 0; diy::reduce(master, assigner, partners, - [&](BlockType* block, const diy::ReduceProxy& rp, const diy::RegularAllReducePartners&) { + [&](BlockType* block, const diy::ReduceProxy& rp, const diy::RegularAllReducePartners&) + { // step 1 dequeue and merge for (int i = 0; i < rp.in_link().size(); ++i) { @@ -336,8 +337,9 @@ void vtkDIYGhostUtilities::ExchangeBoundingBoxes( { using BlockType = typename DataSetTypeToBlockTypeConverter<DataSetT>::BlockType; - diy::all_to_all( - master, assigner, [&master, &inputs](BlockType* block, const diy::ReduceProxy& srp) { + diy::all_to_all(master, assigner, + [&master, &inputs](BlockType* block, const diy::ReduceProxy& srp) + { int myBlockId = srp.gid(); int localId = master.lid(myBlockId); auto& input = inputs[localId]; @@ -386,44 +388,49 @@ bool vtkDIYGhostUtilities::ExchangeGhosts(diy::Master& master, diy::Assigner& as { using BlockType = typename DataSetTypeToBlockTypeConverter<DataSetT>::BlockType; - master.foreach ([&master, &inputs](BlockType* block, const diy::Master::ProxyWithLink& cp) { - int myBlockId = cp.gid(); - int localId = master.lid(myBlockId); - auto& input = inputs[localId]; - - for (int id = 0; id < static_cast<int>(cp.link()->size()); ++id) + master.foreach ( + [&master, &inputs](BlockType* block, const diy::Master::ProxyWithLink& cp) { - const diy::BlockID& blockId = cp.link()->target(id); - vtkDIYGhostUtilities::EnqueueGhosts(cp, blockId, input, block); - } - }); + int myBlockId = cp.gid(); + int localId = master.lid(myBlockId); + auto& input = inputs[localId]; + + for (int id = 0; id < static_cast<int>(cp.link()->size()); ++id) + { + const diy::BlockID& blockId = cp.link()->target(id); + vtkDIYGhostUtilities::EnqueueGhosts(cp, blockId, input, block); + } + }); master.exchange(); bool error = false; - master.foreach ([&error](BlockType* block, const diy::Master::ProxyWithLink& cp) { - std::vector<int> incoming; - cp.incoming(incoming); - for (const int& gid : incoming) + master.foreach ( + [&error](BlockType* block, const diy::Master::ProxyWithLink& cp) { - // we need this extra check because incoming is not empty when using only one block - if (!cp.incoming(gid).empty()) + std::vector<int> incoming; + cp.incoming(incoming); + for (const int& gid : incoming) { - auto it = block->BlockStructures.find(gid); - if (it == block->BlockStructures.end()) + // we need this extra check because incoming is not empty when using only one block + if (!cp.incoming(gid).empty()) { - error = true; - } - else - { - vtkDIYGhostUtilities::DequeueGhosts(cp, gid, block->BlockStructures.at(gid)); + auto it = block->BlockStructures.find(gid); + if (it == block->BlockStructures.end()) + { + error = true; + } + else + { + vtkDIYGhostUtilities::DequeueGhosts(cp, gid, block->BlockStructures.at(gid)); + } } } - } - }); + }); diy::reduce(master, assigner, partners, - [&error](BlockType*, const diy::ReduceProxy& rp, const diy::RegularAllReducePartners&) { + [&error](BlockType*, const diy::ReduceProxy& rp, const diy::RegularAllReducePartners&) + { for (int i = 0; i < rp.in_link().size(); ++i) { int gid = rp.in_link().target(i).gid; diff --git a/Parallel/MPI/Testing/Cxx/ExerciseMultiProcessController.cxx b/Parallel/MPI/Testing/Cxx/ExerciseMultiProcessController.cxx index cd41803bbdd..2cad45f025d 100644 --- a/Parallel/MPI/Testing/Cxx/ExerciseMultiProcessController.cxx +++ b/Parallel/MPI/Testing/Cxx/ExerciseMultiProcessController.cxx @@ -334,7 +334,8 @@ static int CompareDataObjects(vtkDataObject* obj1, vtkDataObject* obj2) vtkPolyData* pd1 = vtkPolyData::SafeDownCast(ps1); vtkPolyData* pd2 = vtkPolyData::SafeDownCast(ps2); - auto compareCellArrays = [](vtkCellArray* ca1, vtkCellArray* ca2) -> bool { + auto compareCellArrays = [](vtkCellArray* ca1, vtkCellArray* ca2) -> bool + { return (CompareDataArrays(ca1->GetOffsetsArray(), ca2->GetOffsetsArray()) && CompareDataArrays(ca1->GetConnectivityArray(), ca2->GetConnectivityArray())); }; diff --git a/Rendering/Core/Testing/Cxx/TestBlockVisibility.cxx b/Rendering/Core/Testing/Cxx/TestBlockVisibility.cxx index fda99341bad..25da5ec54a1 100644 --- a/Rendering/Core/Testing/Cxx/TestBlockVisibility.cxx +++ b/Rendering/Core/Testing/Cxx/TestBlockVisibility.cxx @@ -90,14 +90,16 @@ int TestBlockVisibility(int argc, char* argv[]) int numVisited = 0; int numVisible = 0; - attrs->VisitVisibilities([&numVisited, &numVisible](vtkDataObject*, bool visible) { - if (visible) + attrs->VisitVisibilities( + [&numVisited, &numVisible](vtkDataObject*, bool visible) { - ++numVisible; - } - ++numVisited; - return false; // do not terminate loop early. - }); + if (visible) + { + ++numVisible; + } + ++numVisited; + return false; // do not terminate loop early. + }); if (numVisited != static_cast<int>(mbds->GetNumberOfBlocks())) { diff --git a/Rendering/Core/Testing/Cxx/TestCompositePolyDataMapperPickability.cxx b/Rendering/Core/Testing/Cxx/TestCompositePolyDataMapperPickability.cxx index 0f9df0db92a..bf799c3d38a 100644 --- a/Rendering/Core/Testing/Cxx/TestCompositePolyDataMapperPickability.cxx +++ b/Rendering/Core/Testing/Cxx/TestCompositePolyDataMapperPickability.cxx @@ -198,20 +198,24 @@ int TestCompositePolyDataMapperPickability(int argc, char* argv[]) sel->Delete(); // One block in every possible state. - prepareDisplayAttribute(expected, da, mb, [](int nn) { - --nn; - return std::pair<bool, bool>(!!(nn / 2), !!(nn % 2)); - }); + prepareDisplayAttribute(expected, da, mb, + [](int nn) + { + --nn; + return std::pair<bool, bool>(!!(nn / 2), !!(nn % 2)); + }); mp->Modified(); sel = hw->Select(); retVal &= checkSelection(sel, expected, testNum); sel->Delete(); // One block in every possible state (but different). - prepareDisplayAttribute(expected, da, mb, [](int nn) { - --nn; - return std::pair<bool, bool>(!(nn / 2), !(nn % 2)); - }); + prepareDisplayAttribute(expected, da, mb, + [](int nn) + { + --nn; + return std::pair<bool, bool>(!(nn / 2), !(nn % 2)); + }); mp->Modified(); sel = hw->Select(); retVal &= checkSelection(sel, expected, testNum); diff --git a/Rendering/Core/Testing/Cxx/TestCompositePolyDataMapperToggleScalarVisibilities.cxx b/Rendering/Core/Testing/Cxx/TestCompositePolyDataMapperToggleScalarVisibilities.cxx index 6c3fdf516df..5dea024c633 100644 --- a/Rendering/Core/Testing/Cxx/TestCompositePolyDataMapperToggleScalarVisibilities.cxx +++ b/Rendering/Core/Testing/Cxx/TestCompositePolyDataMapperToggleScalarVisibilities.cxx @@ -72,62 +72,64 @@ int TestCompositePolyDataMapperToggleScalarVisibilities(int argc, char* argv[]) vtkNew<vtkCallbackCommand> charCallback; charCallback->SetClientData(mapper); - charCallback->SetCallback([](vtkObject* caller, unsigned long, void* clientdata, void*) { - auto istyle = reinterpret_cast<vtkInteractorStyleSwitch*>(caller); - auto* interactor = istyle->GetCurrentStyle()->GetInteractor(); - if (istyle == nullptr) + charCallback->SetCallback( + [](vtkObject* caller, unsigned long, void* clientdata, void*) { - std::cerr << "istyle is null!\n"; - return; - } - if (interactor == nullptr) - { - std::cerr << "interactor is null!\n"; - return; - } - auto inputMapper = reinterpret_cast<vtkCompositePolyDataMapper*>(clientdata); - if (inputMapper == nullptr) - { - std::cerr << "Mapper is null!\n"; - return; - } - auto* inputCda = inputMapper->GetCompositeDataDisplayAttributes(); - auto keyCode = interactor->GetKeyCode(); - switch (keyCode) - { - case 'n': - case 'N': - ++selectedSphere; - break; - default: - istyle->OnChar(); + auto istyle = reinterpret_cast<vtkInteractorStyleSwitch*>(caller); + auto* interactor = istyle->GetCurrentStyle()->GetInteractor(); + if (istyle == nullptr) + { + std::cerr << "istyle is null!\n"; return; - } - if (auto* compositeMesh = - vtkPartitionedDataSetCollection::SafeDownCast(inputMapper->GetInputDataObject(0, 0))) - { - const unsigned int n = compositeMesh->GetNumberOfPartitionedDataSets(); - selectedSphere %= (n + 1); - std::string text = "Selected sphere: " + std::to_string(selectedSphere); - if (auto* mesh = compositeMesh->GetPartitionAsDataObject(selectedSphere, 0)) + } + if (interactor == nullptr) { - const auto flatIndex = compositeMesh->GetCompositeIndex(selectedSphere, 0); - std::cout << "Turn off scalar visibility for sphere at flat index: " << flatIndex << '\n'; - inputCda->RemoveBlockScalarVisibilities(); - inputCda->SetBlockScalarVisibility(mesh, false); - double color[3] = { 1.0, 1.0, 0.0 }; - inputCda->SetBlockColor(mesh, color); - interactor->GetRenderWindow()->Render(); + std::cerr << "interactor is null!\n"; + return; } - else + auto inputMapper = reinterpret_cast<vtkCompositePolyDataMapper*>(clientdata); + if (inputMapper == nullptr) { - std::cout << "Color all spheres using scalars\n"; - inputCda->RemoveBlockScalarVisibilities(); - inputCda->RemoveBlockColors(); - interactor->GetRenderWindow()->Render(); + std::cerr << "Mapper is null!\n"; + return; } - } - }); + auto* inputCda = inputMapper->GetCompositeDataDisplayAttributes(); + auto keyCode = interactor->GetKeyCode(); + switch (keyCode) + { + case 'n': + case 'N': + ++selectedSphere; + break; + default: + istyle->OnChar(); + return; + } + if (auto* compositeMesh = + vtkPartitionedDataSetCollection::SafeDownCast(inputMapper->GetInputDataObject(0, 0))) + { + const unsigned int n = compositeMesh->GetNumberOfPartitionedDataSets(); + selectedSphere %= (n + 1); + std::string text = "Selected sphere: " + std::to_string(selectedSphere); + if (auto* mesh = compositeMesh->GetPartitionAsDataObject(selectedSphere, 0)) + { + const auto flatIndex = compositeMesh->GetCompositeIndex(selectedSphere, 0); + std::cout << "Turn off scalar visibility for sphere at flat index: " << flatIndex << '\n'; + inputCda->RemoveBlockScalarVisibilities(); + inputCda->SetBlockScalarVisibility(mesh, false); + double color[3] = { 1.0, 1.0, 0.0 }; + inputCda->SetBlockColor(mesh, color); + interactor->GetRenderWindow()->Render(); + } + else + { + std::cout << "Color all spheres using scalars\n"; + inputCda->RemoveBlockScalarVisibilities(); + inputCda->RemoveBlockColors(); + interactor->GetRenderWindow()->Render(); + } + } + }); vtkNew<vtkRenderWindowInteractor> interactor; interactor->SetRenderWindow(window); diff --git a/Rendering/Core/Testing/Cxx/TestGlyph3DMapper.cxx b/Rendering/Core/Testing/Cxx/TestGlyph3DMapper.cxx index e57c3dfd785..f30b2c5615e 100644 --- a/Rendering/Core/Testing/Cxx/TestGlyph3DMapper.cxx +++ b/Rendering/Core/Testing/Cxx/TestGlyph3DMapper.cxx @@ -17,7 +17,7 @@ // If USE_FILTER is defined, glyph3D->PolyDataMapper is used instead of // Glyph3DMapper. -//#define USE_FILTER +// #define USE_FILTER #ifdef USE_FILTER #include "vtkGlyph3D.h" diff --git a/Rendering/Core/Testing/Cxx/TestGlyph3DMapperArrow.cxx b/Rendering/Core/Testing/Cxx/TestGlyph3DMapperArrow.cxx index 6a3e06eb7cf..316cabb7d65 100644 --- a/Rendering/Core/Testing/Cxx/TestGlyph3DMapperArrow.cxx +++ b/Rendering/Core/Testing/Cxx/TestGlyph3DMapperArrow.cxx @@ -22,7 +22,7 @@ // If USE_FILTER is defined, glyph3D->PolyDataMapper is used instead of // Glyph3DMapper. -//#define USE_FILTER +// #define USE_FILTER #ifdef USE_FILTER #include "vtkGlyph3D.h" diff --git a/Rendering/Core/Testing/Cxx/TestGlyph3DMapperMasking.cxx b/Rendering/Core/Testing/Cxx/TestGlyph3DMapperMasking.cxx index 1da3a75fdef..3b0c5e713c7 100644 --- a/Rendering/Core/Testing/Cxx/TestGlyph3DMapperMasking.cxx +++ b/Rendering/Core/Testing/Cxx/TestGlyph3DMapperMasking.cxx @@ -22,7 +22,7 @@ // If USE_FILTER is defined, glyph3D->PolyDataMapper is used instead of // Glyph3DMapper. -//#define USE_FILTER +// #define USE_FILTER #ifdef USE_FILTER #include "vtkGlyph3D.h" diff --git a/Rendering/Core/Testing/Cxx/TestGlyph3DMapperOrientationArray.cxx b/Rendering/Core/Testing/Cxx/TestGlyph3DMapperOrientationArray.cxx index df164d27866..bf420c9bbf3 100644 --- a/Rendering/Core/Testing/Cxx/TestGlyph3DMapperOrientationArray.cxx +++ b/Rendering/Core/Testing/Cxx/TestGlyph3DMapperOrientationArray.cxx @@ -23,7 +23,7 @@ // If USE_FILTER is defined, glyph3D->PolyDataMapper is used instead of // Glyph3DMapper. -//#define USE_FILTER +// #define USE_FILTER #ifdef USE_FILTER #include "vtkGlyph3D.h" diff --git a/Rendering/Core/Testing/Cxx/TestViewDependentErrorMetric.cxx b/Rendering/Core/Testing/Cxx/TestViewDependentErrorMetric.cxx index 736f537fb10..3d5638b2a66 100644 --- a/Rendering/Core/Testing/Cxx/TestViewDependentErrorMetric.cxx +++ b/Rendering/Core/Testing/Cxx/TestViewDependentErrorMetric.cxx @@ -9,7 +9,7 @@ // not allow interaction and exit // -D <path> => path to the data; the data should be in <path>/Data/ -//#define WRITE_GENERIC_RESULT +// #define WRITE_GENERIC_RESULT #include "vtkActor.h" #include "vtkActor2D.h" diff --git a/Rendering/Core/vtkBillboardTextActor3D.cxx b/Rendering/Core/vtkBillboardTextActor3D.cxx index 70ebd168a2e..d5fad81a45f 100644 --- a/Rendering/Core/vtkBillboardTextActor3D.cxx +++ b/Rendering/Core/vtkBillboardTextActor3D.cxx @@ -25,7 +25,7 @@ #include <cmath> // Define to print debugging info: -//#define DEBUG_BTA3D +// #define DEBUG_BTA3D VTK_ABI_NAMESPACE_BEGIN namespace diff --git a/Rendering/Core/vtkCompositePolyDataMapper.cxx b/Rendering/Core/vtkCompositePolyDataMapper.cxx index c185c8a538a..33ab9db6e17 100644 --- a/Rendering/Core/vtkCompositePolyDataMapper.cxx +++ b/Rendering/Core/vtkCompositePolyDataMapper.cxx @@ -491,7 +491,8 @@ vtkCompositePolyDataMapper::MapperHashType vtkCompositePolyDataMapper::InsertPol auto createBatchElement = [](vtkPolyData* _polydata, - unsigned int _flatIndex) -> vtkCompositePolyDataMapperDelegator::BatchElement { + unsigned int _flatIndex) -> vtkCompositePolyDataMapperDelegator::BatchElement + { vtkCompositePolyDataMapperDelegator::BatchElement element; element.PolyData = _polydata; element.FlatIndex = _flatIndex; diff --git a/Rendering/Core/vtkStateStorage.h b/Rendering/Core/vtkStateStorage.h index 03f48ebdfc5..78b725f3415 100644 --- a/Rendering/Core/vtkStateStorage.h +++ b/Rendering/Core/vtkStateStorage.h @@ -43,7 +43,7 @@ #include <vector> // uncomment the following line to add in state debugging information -//#define USE_STATE_DEBUGGING 1 +// #define USE_STATE_DEBUGGING 1 #ifdef USE_STATE_DEBUGGING VTK_ABI_NAMESPACE_BEGIN diff --git a/Rendering/Core/vtkStereoCompositor.cxx b/Rendering/Core/vtkStereoCompositor.cxx index acfcf015dde..ac1159ce05f 100644 --- a/Rendering/Core/vtkStereoCompositor.cxx +++ b/Rendering/Core/vtkStereoCompositor.cxx @@ -54,7 +54,8 @@ bool vtkStereoCompositor::RedBlue( } vtkSMPTools::For(0, rgbLeftNResult->GetNumberOfTuples(), - [rgbLeftNResult, rgbRight](vtkIdType first, vtkIdType last) { + [rgbLeftNResult, rgbRight](vtkIdType first, vtkIdType last) + { unsigned char value[3]; unsigned char output[3] = { 0, 0, 0 }; for (auto cc = first; cc < last; ++cc) @@ -95,44 +96,46 @@ bool vtkStereoCompositor::Anaglyph(vtkUnsignedCharArray* rgbLeftNResult, satcolor[x] = int(a * x); } - vtkSMPTools::For(0, rgbLeftNResult->GetNumberOfTuples(), [&](vtkIdType first, vtkIdType last) { - unsigned char inL[3], inR[3]; - unsigned char out[3]; - for (auto cc = first; cc < last; ++cc) + vtkSMPTools::For(0, rgbLeftNResult->GetNumberOfTuples(), + [&](vtkIdType first, vtkIdType last) { - rgbLeftNResult->GetTypedTuple(cc, inL); - rgbRight->GetTypedTuple(cc, inR); - - auto ave0 = avecolor[inL[0]][0] + avecolor[inL[1]][1] + avecolor[inL[2]][2]; - auto ave1 = avecolor[inR[0]][0] + avecolor[inR[1]][1] + avecolor[inR[2]][2]; - - if (m0 & 0x4) - { - out[0] = satcolor[inL[0]] + ave0; - } - if (m0 & 0x2) - { - out[1] = satcolor[inL[1]] + ave0; - } - if (m0 & 0x1) - { - out[2] = satcolor[inL[2]] + ave0; - } - if (m1 & 0x4) - { - out[0] = satcolor[inR[0]] + ave1; - } - if (m1 & 0x2) - { - out[1] = satcolor[inR[1]] + ave1; - } - if (m1 & 0x1) + unsigned char inL[3], inR[3]; + unsigned char out[3]; + for (auto cc = first; cc < last; ++cc) { - out[2] = satcolor[inR[2]] + ave1; + rgbLeftNResult->GetTypedTuple(cc, inL); + rgbRight->GetTypedTuple(cc, inR); + + auto ave0 = avecolor[inL[0]][0] + avecolor[inL[1]][1] + avecolor[inL[2]][2]; + auto ave1 = avecolor[inR[0]][0] + avecolor[inR[1]][1] + avecolor[inR[2]][2]; + + if (m0 & 0x4) + { + out[0] = satcolor[inL[0]] + ave0; + } + if (m0 & 0x2) + { + out[1] = satcolor[inL[1]] + ave0; + } + if (m0 & 0x1) + { + out[2] = satcolor[inL[2]] + ave0; + } + if (m1 & 0x4) + { + out[0] = satcolor[inR[0]] + ave1; + } + if (m1 & 0x2) + { + out[1] = satcolor[inR[1]] + ave1; + } + if (m1 & 0x1) + { + out[2] = satcolor[inR[2]] + ave1; + } + rgbLeftNResult->SetTypedTuple(cc, out); } - rgbLeftNResult->SetTypedTuple(cc, out); - } - }); + }); return true; } diff --git a/Rendering/LICOpenGL2/vtkLICNoiseHelper.cxx b/Rendering/LICOpenGL2/vtkLICNoiseHelper.cxx index 86efe8e586e..f1c060764dc 100644 --- a/Rendering/LICOpenGL2/vtkLICNoiseHelper.cxx +++ b/Rendering/LICOpenGL2/vtkLICNoiseHelper.cxx @@ -230,9 +230,9 @@ float* vtkLICRandomNoise2D::GenerateGaussian(int sideLen, int grainSize, float m // restrict int l = static_cast<int>(val * nLevels); l = l > maxLevel ? maxLevel : l; - rvals[i] = rvals[i] < minVal - ? impulseBgNoiseVal - : nLevels == 1 ? maxNoiseVal : minNoiseVal + (l * delta) * noiseRange; + rvals[i] = rvals[i] < minVal ? impulseBgNoiseVal + : nLevels == 1 ? maxNoiseVal + : minNoiseVal + (l * delta) * noiseRange; } // map single pixel random values onto a patch of values of diff --git a/Rendering/LICOpenGL2/vtkSurfaceLICComposite.cxx b/Rendering/LICOpenGL2/vtkSurfaceLICComposite.cxx index a98fb7a6d2a..7e684343cfa 100644 --- a/Rendering/LICOpenGL2/vtkSurfaceLICComposite.cxx +++ b/Rendering/LICOpenGL2/vtkSurfaceLICComposite.cxx @@ -221,9 +221,10 @@ float vtkSurfaceLICComposite::GetFudgeFactor(int nx[2]) { float aspect = float(nx[0]) / float(nx[1]); float fudge = (aspect > 4.0f) ? 3.0f - : (aspect > 1.0f) - ? (2.0f / 3.0f) * aspect + (5.0f / 6.0f) - : (aspect < 0.25) ? 3.0f : (aspect < 1.0f) ? (-8.0f / 3.0f) * aspect + (25.0f / 6.0f) : 1.5f; + : (aspect > 1.0f) ? (2.0f / 3.0f) * aspect + (5.0f / 6.0f) + : (aspect < 0.25) ? 3.0f + : (aspect < 1.0f) ? (-8.0f / 3.0f) * aspect + (25.0f / 6.0f) + : 1.5f; return fudge; } diff --git a/Rendering/Label/Testing/Cxx/TestLabelPlacementMapper2D.cxx b/Rendering/Label/Testing/Cxx/TestLabelPlacementMapper2D.cxx index 7aa3830108d..95977de97ca 100644 --- a/Rendering/Label/Testing/Cxx/TestLabelPlacementMapper2D.cxx +++ b/Rendering/Label/Testing/Cxx/TestLabelPlacementMapper2D.cxx @@ -25,7 +25,7 @@ #define PTSMULT 10 #define TXTMULT (PTSMULT * PTSMULT) -//#define GENERATE_TEST_POINTS +// #define GENERATE_TEST_POINTS static const char* vtkTextLabelList[] = { "Barbey", diff --git a/Rendering/Label/Testing/Cxx/TestLabelPlacer2D.cxx b/Rendering/Label/Testing/Cxx/TestLabelPlacer2D.cxx index 4a4d918a7d2..99ca215a817 100644 --- a/Rendering/Label/Testing/Cxx/TestLabelPlacer2D.cxx +++ b/Rendering/Label/Testing/Cxx/TestLabelPlacer2D.cxx @@ -25,7 +25,7 @@ #define PTSMULT 10 #define TXTMULT (PTSMULT * PTSMULT) -//#define GENERATE_TEST_POINTS +// #define GENERATE_TEST_POINTS static const char* vtkTextLabelList[] = { "Barbey", diff --git a/Rendering/OpenGL2/Testing/Cxx/TestBlockVisibility.cxx b/Rendering/OpenGL2/Testing/Cxx/TestBlockVisibility.cxx index 6f564a03a11..c92d1ab6b67 100644 --- a/Rendering/OpenGL2/Testing/Cxx/TestBlockVisibility.cxx +++ b/Rendering/OpenGL2/Testing/Cxx/TestBlockVisibility.cxx @@ -90,14 +90,16 @@ int TestBlockVisibility(int argc, char* argv[]) int numVisited = 0; int numVisible = 0; - attrs->VisitVisibilities([&numVisited, &numVisible](vtkDataObject*, bool visible) { - if (visible) + attrs->VisitVisibilities( + [&numVisited, &numVisible](vtkDataObject*, bool visible) { - ++numVisible; - } - ++numVisited; - return false; // do not terminate loop early. - }); + if (visible) + { + ++numVisible; + } + ++numVisited; + return false; // do not terminate loop early. + }); if (numVisited != static_cast<int>(mbds->GetNumberOfBlocks())) { diff --git a/Rendering/OpenGL2/Testing/Cxx/TestBlurAndSobelPasses.cxx b/Rendering/OpenGL2/Testing/Cxx/TestBlurAndSobelPasses.cxx index 4a5448cd60c..ab8f56074fb 100644 --- a/Rendering/OpenGL2/Testing/Cxx/TestBlurAndSobelPasses.cxx +++ b/Rendering/OpenGL2/Testing/Cxx/TestBlurAndSobelPasses.cxx @@ -28,7 +28,7 @@ #include "vtkLightsPass.h" #include "vtkOpaquePass.h" #include "vtkSequencePass.h" -//#include "vtkDepthPeelingPass.h" +// #include "vtkDepthPeelingPass.h" #include "vtkConeSource.h" #include "vtkGaussianBlurPass.h" #include "vtkOverlayPass.h" diff --git a/Rendering/OpenGL2/Testing/Cxx/TestCompositePolyDataMapper2Pickability.cxx b/Rendering/OpenGL2/Testing/Cxx/TestCompositePolyDataMapper2Pickability.cxx index 64e9a1722cf..c5e528bb7f1 100644 --- a/Rendering/OpenGL2/Testing/Cxx/TestCompositePolyDataMapper2Pickability.cxx +++ b/Rendering/OpenGL2/Testing/Cxx/TestCompositePolyDataMapper2Pickability.cxx @@ -201,20 +201,24 @@ int TestCompositePolyDataMapper2Pickability(int argc, char* argv[]) sel->Delete(); // One block in every possible state. - prepareDisplayAttribute(expected, da, mb, [](int nn) { - --nn; - return std::pair<bool, bool>(!!(nn / 2), !!(nn % 2)); - }); + prepareDisplayAttribute(expected, da, mb, + [](int nn) + { + --nn; + return std::pair<bool, bool>(!!(nn / 2), !!(nn % 2)); + }); mp->Modified(); sel = hw->Select(); retVal &= checkSelection(sel, expected, testNum); sel->Delete(); // One block in every possible state (but different). - prepareDisplayAttribute(expected, da, mb, [](int nn) { - --nn; - return std::pair<bool, bool>(!(nn / 2), !(nn % 2)); - }); + prepareDisplayAttribute(expected, da, mb, + [](int nn) + { + --nn; + return std::pair<bool, bool>(!(nn / 2), !(nn % 2)); + }); mp->Modified(); sel = hw->Select(); retVal &= checkSelection(sel, expected, testNum); diff --git a/Rendering/OpenGL2/Testing/Cxx/TestFluidMapper.cxx b/Rendering/OpenGL2/Testing/Cxx/TestFluidMapper.cxx index 8a7086e43fc..65beadac3c4 100644 --- a/Rendering/OpenGL2/Testing/Cxx/TestFluidMapper.cxx +++ b/Rendering/OpenGL2/Testing/Cxx/TestFluidMapper.cxx @@ -48,7 +48,7 @@ constexpr static float g_ParticleRadius = 0.03f; //------------------------------------------------------------------------------ // Enable this for interactive demonstration -//#define INTERACTIVE_DEMO +// #define INTERACTIVE_DEMO #ifdef INTERACTIVE_DEMO #include "TestFluidDemo.cxx" #endif diff --git a/Rendering/OpenGL2/Testing/Cxx/TestFramebufferHDR.cxx b/Rendering/OpenGL2/Testing/Cxx/TestFramebufferHDR.cxx index fc8d9eabd90..6090a14b73c 100644 --- a/Rendering/OpenGL2/Testing/Cxx/TestFramebufferHDR.cxx +++ b/Rendering/OpenGL2/Testing/Cxx/TestFramebufferHDR.cxx @@ -6,7 +6,7 @@ #include "vtkActor.h" #include "vtkCamera.h" -//#include "vtkCellArray.h" +// #include "vtkCellArray.h" #include "vtkFramebufferPass.h" #include "vtkNew.h" #include "vtkOpenGLRenderer.h" diff --git a/Rendering/OpenGL2/Testing/Cxx/TestGlyph3DMapperPickability.cxx b/Rendering/OpenGL2/Testing/Cxx/TestGlyph3DMapperPickability.cxx index c146f1f2669..1d5f66969a3 100644 --- a/Rendering/OpenGL2/Testing/Cxx/TestGlyph3DMapperPickability.cxx +++ b/Rendering/OpenGL2/Testing/Cxx/TestGlyph3DMapperPickability.cxx @@ -203,20 +203,24 @@ int TestGlyph3DMapperPickability(int argc, char* argv[]) sel->Delete(); // One block in every possible state. - prepareDisplayAttribute(expected, cdda, multiBlock, [](int nn) { - --nn; - return std::pair<bool, bool>(!!(nn / 2), !!(nn % 2)); - }); + prepareDisplayAttribute(expected, cdda, multiBlock, + [](int nn) + { + --nn; + return std::pair<bool, bool>(!!(nn / 2), !!(nn % 2)); + }); multiBlock->Modified(); sel = hw->Select(); retVal &= checkSelection(sel, expected, testNum); sel->Delete(); // One block in every possible state (but different). - prepareDisplayAttribute(expected, cdda, multiBlock, [](int nn) { - --nn; - return std::pair<bool, bool>(!(nn / 2), !(nn % 2)); - }); + prepareDisplayAttribute(expected, cdda, multiBlock, + [](int nn) + { + --nn; + return std::pair<bool, bool>(!(nn / 2), !(nn % 2)); + }); multiBlock->Modified(); sel = hw->Select(); retVal &= checkSelection(sel, expected, testNum); diff --git a/Rendering/OpenGL2/Testing/Cxx/TestPointGaussianMapper.cxx b/Rendering/OpenGL2/Testing/Cxx/TestPointGaussianMapper.cxx index 32942ecf2c2..c245076cea2 100644 --- a/Rendering/OpenGL2/Testing/Cxx/TestPointGaussianMapper.cxx +++ b/Rendering/OpenGL2/Testing/Cxx/TestPointGaussianMapper.cxx @@ -36,8 +36,8 @@ #include "vtkPolyDataReader.h" -//#define TestPoints -//#define TestFile +// #define TestPoints +// #define TestFile #define TestSplats int TestPointGaussianMapper(int argc, char* argv[]) diff --git a/Rendering/OpenGL2/Testing/Cxx/TestSobelGradientMagnitudePass.cxx b/Rendering/OpenGL2/Testing/Cxx/TestSobelGradientMagnitudePass.cxx index 7ccbcbe923c..6f16b7b5ae5 100644 --- a/Rendering/OpenGL2/Testing/Cxx/TestSobelGradientMagnitudePass.cxx +++ b/Rendering/OpenGL2/Testing/Cxx/TestSobelGradientMagnitudePass.cxx @@ -28,7 +28,7 @@ #include "vtkLightsPass.h" #include "vtkOpaquePass.h" #include "vtkSequencePass.h" -//#include "vtkDepthPeelingPass.h" +// #include "vtkDepthPeelingPass.h" #include "vtkConeSource.h" #include "vtkOverlayPass.h" #include "vtkRenderPassCollection.h" diff --git a/Rendering/OpenGL2/Testing/Cxx/TestUserShader2D.cxx b/Rendering/OpenGL2/Testing/Cxx/TestUserShader2D.cxx index 1b77ecc2e3c..b6a2747232e 100644 --- a/Rendering/OpenGL2/Testing/Cxx/TestUserShader2D.cxx +++ b/Rendering/OpenGL2/Testing/Cxx/TestUserShader2D.cxx @@ -116,10 +116,12 @@ gl_FragData[0] = vec4(sin(tcoordVCVSOutput.xy * time * 0.01), 0.0, 1.0); vtkNew<vtkCallbackCommand> timerCmd; timerCmd->SetClientData(timerData); timerCmd->SetCallback(::TestUserShader2D_OnTimerCallback); - timerCmd->SetClientDataDeleteCallback([](void* dPtr) { - auto tdPtr = static_cast<TestUserShader2D_TimerData*>(dPtr); - delete tdPtr; - }); + timerCmd->SetClientDataDeleteCallback( + [](void* dPtr) + { + auto tdPtr = static_cast<TestUserShader2D_TimerData*>(dPtr); + delete tdPtr; + }); iren->AddObserver(vtkCommand::TimerEvent, timerCmd); iren->Start(); } diff --git a/Rendering/OpenGL2/vtkCocoaGLView.mm b/Rendering/OpenGL2/vtkCocoaGLView.mm index 6d78e31745e..7ba15ffd1c8 100644 --- a/Rendering/OpenGL2/vtkCocoaGLView.mm +++ b/Rendering/OpenGL2/vtkCocoaGLView.mm @@ -576,7 +576,7 @@ static const char* MacKeyCodeToKeySymTable[128] = { vtkNew<vtkStringArray> filePaths; NSPasteboard* pboard = [sender draggingPasteboard]; - NSArray* fileURLs = [pboard readObjectsForClasses:@ [[NSURL class]] options:nil]; + NSArray* fileURLs = [pboard readObjectsForClasses:@[ [NSURL class] ] options:nil]; for (NSURL* fileURL in fileURLs) { const char* filePath = [fileURL fileSystemRepresentation]; diff --git a/Rendering/OpenGL2/vtkDualDepthPeelingPass.cxx b/Rendering/OpenGL2/vtkDualDepthPeelingPass.cxx index 65ae9a3fe19..c81334d5fda 100644 --- a/Rendering/OpenGL2/vtkDualDepthPeelingPass.cxx +++ b/Rendering/OpenGL2/vtkDualDepthPeelingPass.cxx @@ -28,17 +28,17 @@ #include <algorithm> // Define to output details about each peel: -//#define DEBUG_PEEL +// #define DEBUG_PEEL // Define to output details about each frame: -//#define DEBUG_FRAME +// #define DEBUG_FRAME // Define to render the categorization of the initial volume-prepass pixel: // - Pixels with no opaque or translucent geometry will be red. // - Pixels with only opaque geometry will be green. // - Pixels with only translucent geometry will be blue. // - Pixels with both opaque and translucent geometry will be purple. -//#define DEBUG_VOLUME_PREPASS_PIXELS +// #define DEBUG_VOLUME_PREPASS_PIXELS // Recent OSX/ATI drivers perform some out-of-order execution that's causing // the dFdx/dFdy calls to be conditionally executed. Specifically, it looks diff --git a/Rendering/OpenGL2/vtkEDLShading.cxx b/Rendering/OpenGL2/vtkEDLShading.cxx index a2d55464344..a003ceb46fc 100644 --- a/Rendering/OpenGL2/vtkEDLShading.cxx +++ b/Rendering/OpenGL2/vtkEDLShading.cxx @@ -34,7 +34,7 @@ Ph.D. thesis of Christian BOUCHENY. #include "vtkEDLShadeFS.h" #include "vtkTextureObjectVS.h" -//#define VTK_EDL_SHADING_DEBUG +// #define VTK_EDL_SHADING_DEBUG VTK_ABI_NAMESPACE_BEGIN namespace diff --git a/Rendering/OpenGL2/vtkEGLRenderWindow.cxx b/Rendering/OpenGL2/vtkEGLRenderWindow.cxx index 55d1864b5bf..40fc78ace62 100644 --- a/Rendering/OpenGL2/vtkEGLRenderWindow.cxx +++ b/Rendering/OpenGL2/vtkEGLRenderWindow.cxx @@ -187,7 +187,8 @@ vtkEGLRenderWindow::vtkEGLRenderWindow() this->IsPointSpriteBugTested = false; this->IsPointSpriteBugPresent_ = false; - auto loadFunc = [](void*, const char* name) -> VTKOpenGLAPIProc { + auto loadFunc = [](void*, const char* name) -> VTKOpenGLAPIProc + { if (name) { return eglGetProcAddress(name); diff --git a/Rendering/OpenGL2/vtkGaussianBlurPass.cxx b/Rendering/OpenGL2/vtkGaussianBlurPass.cxx index a1d5413a586..3e7b48e5e20 100644 --- a/Rendering/OpenGL2/vtkGaussianBlurPass.cxx +++ b/Rendering/OpenGL2/vtkGaussianBlurPass.cxx @@ -19,7 +19,7 @@ // to be able to dump intermediate passes into png files for debugging. // only for vtkGaussianBlurPass developers. -//#define VTK_GAUSSIAN_BLUR_PASS_DEBUG +// #define VTK_GAUSSIAN_BLUR_PASS_DEBUG #ifdef VTK_GAUSSIAN_BLUR_PASS_DEBUG #include "vtkImageExtractComponents.h" diff --git a/Rendering/OpenGL2/vtkOSOpenGLRenderWindow.cxx b/Rendering/OpenGL2/vtkOSOpenGLRenderWindow.cxx index f935d86ea25..203a83d6715 100644 --- a/Rendering/OpenGL2/vtkOSOpenGLRenderWindow.cxx +++ b/Rendering/OpenGL2/vtkOSOpenGLRenderWindow.cxx @@ -201,7 +201,8 @@ vtkOSOpenGLRenderWindow::vtkOSOpenGLRenderWindow() this->Internal = new vtkOSOpenGLRenderWindowInternal(); this->SetOpenGLSymbolLoader( - [](void* userData, const char* name) -> VTKOpenGLAPIProc { + [](void* userData, const char* name) -> VTKOpenGLAPIProc + { if (auto* internal = reinterpret_cast<vtkOSOpenGLRenderWindowInternal*>(userData)) { return internal->OSMesaGetProcAddress(name); diff --git a/Rendering/OpenGL2/vtkOpenGLCellToVTKCellMap.h b/Rendering/OpenGL2/vtkOpenGLCellToVTKCellMap.h index c82f9c7fe17..6b80df2e466 100644 --- a/Rendering/OpenGL2/vtkOpenGLCellToVTKCellMap.h +++ b/Rendering/OpenGL2/vtkOpenGLCellToVTKCellMap.h @@ -35,9 +35,9 @@ public: // // The same concept applies to cell based picking // - void BuildCellSupportArrays(vtkCellArray * [4], int representation, vtkPoints* points); + void BuildCellSupportArrays(vtkCellArray* [4], int representation, vtkPoints* points); - void BuildPrimitiveOffsetsIfNeeded(vtkCellArray * [4], int representation, vtkPoints* points); + void BuildPrimitiveOffsetsIfNeeded(vtkCellArray* [4], int representation, vtkPoints* points); vtkIdType ConvertOpenGLCellIdToVTKCellId(bool pointPicking, vtkIdType openGLId); diff --git a/Rendering/OpenGL2/vtkOpenGLES30PolyDataMapper2D.cxx b/Rendering/OpenGL2/vtkOpenGLES30PolyDataMapper2D.cxx index fcc33610576..7a73a0e6867 100644 --- a/Rendering/OpenGL2/vtkOpenGLES30PolyDataMapper2D.cxx +++ b/Rendering/OpenGL2/vtkOpenGLES30PolyDataMapper2D.cxx @@ -420,7 +420,8 @@ void vtkOpenGLES30PolyDataMapper2D::UpdateVBO(vtkActor2D* act, vtkViewport* view // populate vertex attributes auto expand = [](vtkSmartPointer<vtkDataArray> src, vtkSmartPointer<vtkDataArray> dst, - const unsigned int* indices, const std::size_t numIndices) { + const unsigned int* indices, const std::size_t numIndices) + { if (src == nullptr || dst == nullptr) { return; diff --git a/Rendering/OpenGL2/vtkOpenGLFXAAFilter.cxx b/Rendering/OpenGL2/vtkOpenGLFXAAFilter.cxx index a5f3c1857d6..ba50eacebe4 100644 --- a/Rendering/OpenGL2/vtkOpenGLFXAAFilter.cxx +++ b/Rendering/OpenGL2/vtkOpenGLFXAAFilter.cxx @@ -29,7 +29,7 @@ #include "vtkFXAAFilterFS.h" // Define to perform/dump benchmarking info: -//#define FXAA_BENCHMARK +// #define FXAA_BENCHMARK VTK_ABI_NAMESPACE_BEGIN vtkStandardNewMacro(vtkOpenGLFXAAFilter); diff --git a/Rendering/OpenGL2/vtkOpenGLHardwareSelector.cxx b/Rendering/OpenGL2/vtkOpenGLHardwareSelector.cxx index 8807d23f5de..632056fbff4 100644 --- a/Rendering/OpenGL2/vtkOpenGLHardwareSelector.cxx +++ b/Rendering/OpenGL2/vtkOpenGLHardwareSelector.cxx @@ -14,7 +14,7 @@ #include "vtkOpenGLError.h" -//#define vtkOpenGLHardwareSelectorDEBUG +// #define vtkOpenGLHardwareSelectorDEBUG #ifdef vtkOpenGLHardwareSelectorDEBUG #include "vtkImageImport.h" #include "vtkNew.h" diff --git a/Rendering/OpenGL2/vtkOpenGLLowMemoryPolyDataMapper.cxx b/Rendering/OpenGL2/vtkOpenGLLowMemoryPolyDataMapper.cxx index f62e02eb728..c99863a9182 100644 --- a/Rendering/OpenGL2/vtkOpenGLLowMemoryPolyDataMapper.cxx +++ b/Rendering/OpenGL2/vtkOpenGLLowMemoryPolyDataMapper.cxx @@ -2542,15 +2542,15 @@ void vtkOpenGLLowMemoryPolyDataMapper::UpdatePBRStateCache(vtkRenderer*, vtkActo actor->GetProperty()->GetCoatStrength() > 0.0; std::vector<TextureInfo> textures = this->GetTextures(actor); - bool usesNormalMap = std::find_if(textures.begin(), textures.end(), [](const TextureInfo& tex) { - return tex.second == "normalTex"; - }) != textures.end(); + bool usesNormalMap = + std::find_if(textures.begin(), textures.end(), + [](const TextureInfo& tex) { return tex.second == "normalTex"; }) != textures.end(); bool usesCoatNormalMap = this->HasClearCoat && std::find_if(textures.begin(), textures.end(), [](const TextureInfo& tex) { return tex.second == "coatNormalTex"; }) != textures.end(); - bool usesRotationMap = std::find_if(textures.begin(), textures.end(), [](const TextureInfo& tex) { - return tex.second == "anisotropyTex"; - }) != textures.end(); + bool usesRotationMap = + std::find_if(textures.begin(), textures.end(), + [](const TextureInfo& tex) { return tex.second == "anisotropyTex"; }) != textures.end(); if (hasAnisotropy != this->HasAnisotropy) { diff --git a/Rendering/OpenGL2/vtkOpenGLPolyDataMapper.cxx b/Rendering/OpenGL2/vtkOpenGLPolyDataMapper.cxx index d962b988804..88667d5ba2d 100644 --- a/Rendering/OpenGL2/vtkOpenGLPolyDataMapper.cxx +++ b/Rendering/OpenGL2/vtkOpenGLPolyDataMapper.cxx @@ -2111,9 +2111,9 @@ void vtkOpenGLPolyDataMapper::ReplaceShaderNormal( // normal mapping std::vector<texinfo> textures = this->GetTextures(actor); - bool normalMapping = std::find_if(textures.begin(), textures.end(), [](const texinfo& tex) { - return tex.second == "normalTex"; - }) != textures.end(); + bool normalMapping = + std::find_if(textures.begin(), textures.end(), + [](const texinfo& tex) { return tex.second == "normalTex"; }) != textures.end(); bool coatNormalMapping = hasClearCoat && std::find_if(textures.begin(), textures.end(), [](const texinfo& tex) { return tex.second == "coatNormalTex"; }) != textures.end(); @@ -2155,9 +2155,9 @@ void vtkOpenGLPolyDataMapper::ReplaceShaderNormal( "//VTK::Normal::Dec\n" "uniform float anisotropyRotationUniform;\n"); - bool rotationMap = std::find_if(textures.begin(), textures.end(), [](const texinfo& tex) { - return tex.second == "anisotropyTex"; - }) != textures.end(); + bool rotationMap = + std::find_if(textures.begin(), textures.end(), + [](const texinfo& tex) { return tex.second == "anisotropyTex"; }) != textures.end(); if (rotationMap) { // Sample the texture @@ -4146,7 +4146,8 @@ void vtkOpenGLPolyDataMapper::AddPointIdsToSelectionPrimitives(vtkPolyData* poly const char* arrayName, unsigned int processId, unsigned int compositeIndex, vtkIdType selectedId) { // point selection - auto addPointId = [this](vtkIdType id) { + auto addPointId = [this](vtkIdType id) + { for (vtkIdType p = vtkOpenGLPolyDataMapper::PrimitiveStart; p <= vtkOpenGLPolyDataMapper::PrimitiveTriStrips; p++) { @@ -4175,7 +4176,8 @@ void vtkOpenGLPolyDataMapper::AddCellIdsToSelectionPrimitives(vtkPolyData* poly, const char* arrayName, unsigned int processId, unsigned int compositeIndex, vtkIdType selectedId) { - auto addCellId = [this, poly](vtkIdType id) { + auto addCellId = [this, poly](vtkIdType id) + { vtkIdType npts; const vtkIdType* pts; vtkIdType nbVerts = poly->GetVerts() ? poly->GetVerts()->GetNumberOfCells() : 0; diff --git a/Rendering/OpenGL2/vtkOpenGLVertexBufferObject.h b/Rendering/OpenGL2/vtkOpenGLVertexBufferObject.h index 979a4b99072..f092c571b13 100644 --- a/Rendering/OpenGL2/vtkOpenGLVertexBufferObject.h +++ b/Rendering/OpenGL2/vtkOpenGLVertexBufferObject.h @@ -19,7 +19,8 @@ class vtkOpenGLVertexBufferObjectCache; */ // useful union for stuffing colors into a float -union vtkFourByteUnion { +union vtkFourByteUnion +{ unsigned char c[4]; short s[2]; float f; diff --git a/Rendering/OpenGL2/vtkPixelBufferObject.cxx b/Rendering/OpenGL2/vtkPixelBufferObject.cxx index cd09ccc3dbf..df2ac984fa8 100644 --- a/Rendering/OpenGL2/vtkPixelBufferObject.cxx +++ b/Rendering/OpenGL2/vtkPixelBufferObject.cxx @@ -9,8 +9,8 @@ #include "vtkOpenGLError.h" -//#define VTK_PBO_DEBUG -//#define VTK_PBO_TIMING +// #define VTK_PBO_DEBUG +// #define VTK_PBO_TIMING #ifdef VTK_PBO_TIMING #include "vtkTimerLog.h" diff --git a/Rendering/OpenGL2/vtkShadowMapBakerPass.cxx b/Rendering/OpenGL2/vtkShadowMapBakerPass.cxx index 4e4ebb28c66..9ca97a4bd61 100644 --- a/Rendering/OpenGL2/vtkShadowMapBakerPass.cxx +++ b/Rendering/OpenGL2/vtkShadowMapBakerPass.cxx @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen // SPDX-License-Identifier: BSD-3-Clause -//#include "vtkAbstractTransform.h" // for helper classes stack and concatenation +// #include "vtkAbstractTransform.h" // for helper classes stack and concatenation #include "vtkShadowMapBakerPass.h" #include "vtkCameraPass.h" #include "vtkInformation.h" @@ -33,8 +33,8 @@ // to be able to dump intermediate passes into png files for debugging. // only for vtkShadowMapBakerPass developers. -//#define VTK_SHADOW_MAP_BAKER_PASS_DEBUG -//#define DONT_DUPLICATE_LIGHTS +// #define VTK_SHADOW_MAP_BAKER_PASS_DEBUG +// #define DONT_DUPLICATE_LIGHTS VTK_ABI_NAMESPACE_BEGIN vtkStandardNewMacro(vtkShadowMapBakerPass); diff --git a/Rendering/OpenGL2/vtkShadowMapPass.cxx b/Rendering/OpenGL2/vtkShadowMapPass.cxx index 2cda6dd5fc3..082df559fb4 100644 --- a/Rendering/OpenGL2/vtkShadowMapPass.cxx +++ b/Rendering/OpenGL2/vtkShadowMapPass.cxx @@ -41,8 +41,8 @@ // to be able to dump intermediate passes into png files for debugging. // only for vtkShadowMapPass developers. -//#define VTK_SHADOW_MAP_PASS_DEBUG -//#define DONT_DUPLICATE_LIGHTS +// #define VTK_SHADOW_MAP_PASS_DEBUG +// #define DONT_DUPLICATE_LIGHTS VTK_ABI_NAMESPACE_BEGIN vtkStandardNewMacro(vtkShadowMapPass); diff --git a/Rendering/OpenGL2/vtkSobelGradientMagnitudePass.cxx b/Rendering/OpenGL2/vtkSobelGradientMagnitudePass.cxx index 82b7247cc0c..9c4325b7dcc 100644 --- a/Rendering/OpenGL2/vtkSobelGradientMagnitudePass.cxx +++ b/Rendering/OpenGL2/vtkSobelGradientMagnitudePass.cxx @@ -20,7 +20,7 @@ // to be able to dump intermediate passes into png files for debugging. // only for vtkSobelGradientMagnitudePass developers. -//#define VTK_SOBEL_PASS_DEBUG +// #define VTK_SOBEL_PASS_DEBUG #ifdef VTK_SOBEL_BLUR_PASS_DEBUG #include "vtkImageExtractComponents.h" diff --git a/Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx b/Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx index ca6c8c456e7..316ead42f8d 100644 --- a/Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx +++ b/Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx @@ -267,7 +267,8 @@ vtkXOpenGLRenderWindow::vtkXOpenGLRenderWindow() this->XCHand = 0; this->XCCustom = 0; - auto loadFunc = [](void*, const char* name) -> VTKOpenGLAPIProc { + auto loadFunc = [](void*, const char* name) -> VTKOpenGLAPIProc + { if (name) { return glXGetProcAddress((const GLubyte*)name); diff --git a/Rendering/OpenXR/vtkOpenXRManager.cxx b/Rendering/OpenXR/vtkOpenXRManager.cxx index 7d759c93d26..862979ff48b 100644 --- a/Rendering/OpenXR/vtkOpenXRManager.cxx +++ b/Rendering/OpenXR/vtkOpenXRManager.cxx @@ -707,7 +707,8 @@ std::vector<const char*> vtkOpenXRManager::SelectExtensions() std::vector<const char*> enabledExtensions; // Add a specific extension to the list of extensions to be enabled, if it is supported. - auto EnableExtensionIfSupported = [&](const char* extensionName) { + auto EnableExtensionIfSupported = [&](const char* extensionName) + { for (uint32_t i = 0; i < extensionCount; i++) { if (strcmp(extensionProperties[i].extensionName, extensionName) == 0) @@ -1034,7 +1035,8 @@ std::tuple<int64_t, int64_t> vtkOpenXRManager::SelectSwapchainPixelFormats() // Choose the first runtime-preferred format that this app supports. auto selectPixelFormat = [&](const std::vector<int64_t>& runtimePreferredFormats, const std::vector<int64_t>& applicationSupportedFormats, - const std::string& formatName) { + const std::string& formatName) + { auto found = std::find_first_of(std::begin(runtimePreferredFormats), std::end(runtimePreferredFormats), std::begin(applicationSupportedFormats), std::end(applicationSupportedFormats)); diff --git a/Rendering/OpenXR/vtkOpenXRManager.h b/Rendering/OpenXR/vtkOpenXRManager.h index f7754e88f8c..f8e2f128afb 100644 --- a/Rendering/OpenXR/vtkOpenXRManager.h +++ b/Rendering/OpenXR/vtkOpenXRManager.h @@ -354,7 +354,8 @@ public: XrAction Action; XrActionType ActionType; - union { + union + { XrActionStateFloat _float; XrActionStateBoolean _boolean; XrActionStatePose _pose; diff --git a/Rendering/OpenXR/vtkOpenXRRenderWindowInteractor.cxx b/Rendering/OpenXR/vtkOpenXRRenderWindowInteractor.cxx index 925f12e761a..ecc16fd1dca 100644 --- a/Rendering/OpenXR/vtkOpenXRRenderWindowInteractor.cxx +++ b/Rendering/OpenXR/vtkOpenXRRenderWindowInteractor.cxx @@ -764,7 +764,8 @@ bool vtkOpenXRRenderWindowInteractor::LoadDefaultBinding(const std::string& bind // Get the XrAction from the string jsonValue["output"] // Store in the actionData the device input guessed from the path // And fill actionSuggestedBindings - auto fillActionSuggestedBindings = [&](const std::string& path, const Json::Value& jsonValue) { + auto fillActionSuggestedBindings = [&](const std::string& path, const Json::Value& jsonValue) + { // Get the action std::string action = jsonValue["output"].asString(); diff --git a/Rendering/Parallel/vtkCompositeRGBAPass.cxx b/Rendering/Parallel/vtkCompositeRGBAPass.cxx index 09dd94eda97..505adc0a5f4 100644 --- a/Rendering/Parallel/vtkCompositeRGBAPass.cxx +++ b/Rendering/Parallel/vtkCompositeRGBAPass.cxx @@ -13,7 +13,7 @@ // to be able to dump intermediate result into png files for debugging. // only for vtkCompositeRGBAPass developers. -//#define VTK_COMPOSITE_RGBAPASS_DEBUG +// #define VTK_COMPOSITE_RGBAPASS_DEBUG #include "vtkCamera.h" #include "vtkImageData.h" @@ -30,7 +30,7 @@ #include <sstream> #ifdef VTK_COMPOSITE_RGBAPASS_DEBUG -//#include <unistd.h> +// #include <unistd.h> #include <sys/syscall.h> #include <sys/types.h> // Linux specific gettid() #endif diff --git a/Rendering/Parallel/vtkCompositeZPass.cxx b/Rendering/Parallel/vtkCompositeZPass.cxx index a14a044a905..29582735fe9 100644 --- a/Rendering/Parallel/vtkCompositeZPass.cxx +++ b/Rendering/Parallel/vtkCompositeZPass.cxx @@ -12,7 +12,7 @@ // to be able to dump intermediate result into png files for debugging. // only for vtkCompositeZPass developers. -//#define VTK_COMPOSITE_ZPASS_DEBUG +// #define VTK_COMPOSITE_ZPASS_DEBUG #include "vtkFrameBufferObjectBase.h" #include "vtkImageData.h" @@ -27,7 +27,7 @@ #include <sstream> #ifdef VTK_COMPOSITE_ZPASS_DEBUG -//#include <unistd.h> +// #include <unistd.h> #include <sys/syscall.h> #include <sys/types.h> // Linux specific gettid() #endif diff --git a/Rendering/Tk/vtkTkImageViewerWidget.cxx b/Rendering/Tk/vtkTkImageViewerWidget.cxx index 2ff8a7856cf..04da7de4230 100644 --- a/Rendering/Tk/vtkTkImageViewerWidget.cxx +++ b/Rendering/Tk/vtkTkImageViewerWidget.cxx @@ -385,8 +385,7 @@ extern "C" #endif Tcl_EventuallyFree((ClientData)self, vtkTkImageViewerWidget_Destroy); break; - default - : + default: // nothing ; } diff --git a/Rendering/Tk/vtkTkRenderWidget.cxx b/Rendering/Tk/vtkTkRenderWidget.cxx index 74d18cadcee..cc6122e4409 100644 --- a/Rendering/Tk/vtkTkRenderWidget.cxx +++ b/Rendering/Tk/vtkTkRenderWidget.cxx @@ -149,7 +149,8 @@ extern "C" char typeCheck[256]; unsigned long long l; sscanf(argv[1], "_%llx_%s", &l, typeCheck); - union { + union + { void* p; uintptr_t l; } u; @@ -672,8 +673,7 @@ extern "C" case DestroyNotify: Tcl_EventuallyFree((ClientData)self, vtkTkRenderWidget_Destroy); break; - default - : + default: // nothing ; } diff --git a/Rendering/UI/vtkWin32RenderWindowInteractor.cxx b/Rendering/UI/vtkWin32RenderWindowInteractor.cxx index 88ba02579d4..38a6902f96f 100644 --- a/Rendering/UI/vtkWin32RenderWindowInteractor.cxx +++ b/Rendering/UI/vtkWin32RenderWindowInteractor.cxx @@ -61,7 +61,7 @@ VTK_ABI_NAMESPACE_END typedef TOUCHINPUT* PTOUCHINPUT; -//#define HTOUCHINPUT ULONG +// #define HTOUCHINPUT ULONG #define TOUCHEVENTF_MOVE 0x0001 #define TOUCHEVENTF_DOWN 0x0002 #define TOUCHEVENTF_UP 0x0004 diff --git a/Rendering/VR/vtkVRCollaborationClient.cxx b/Rendering/VR/vtkVRCollaborationClient.cxx index 3c86a1f758b..8e3ab7f1273 100644 --- a/Rendering/VR/vtkVRCollaborationClient.cxx +++ b/Rendering/VR/vtkVRCollaborationClient.cxx @@ -152,7 +152,8 @@ vtkVRCollaborationClient::vtkVRCollaborationClient() this->EventCommand->SetCallback(vtkVRCollaborationClient::EventCallback); // setup default scale callback - this->ScaleCallback = [this]() { + this->ScaleCallback = [this]() + { auto ovrrw = vtkVRRenderWindow::SafeDownCast(this->RenderWindow); return ovrrw ? ovrrw->GetPhysicalScale() : 1.0; }; diff --git a/Rendering/VR/vtkVRInteractorStyle.cxx b/Rendering/VR/vtkVRInteractorStyle.cxx index 5b104866b6d..83f5a677389 100644 --- a/Rendering/VR/vtkVRInteractorStyle.cxx +++ b/Rendering/VR/vtkVRInteractorStyle.cxx @@ -478,28 +478,30 @@ void vtkVRInteractorStyle::StartClip(vtkEventDataDevice3D* ed) if (this->CurrentRenderer != nullptr) { - ForEachNonWidgetProp(this->CurrentRenderer, [this, dev](vtkProp* prop) { - auto* actor = vtkActor::SafeDownCast(prop); - if (actor) + ForEachNonWidgetProp(this->CurrentRenderer, + [this, dev](vtkProp* prop) { - auto* mapper = actor->GetMapper(); - if (mapper) + auto* actor = vtkActor::SafeDownCast(prop); + if (actor) { - mapper->AddClippingPlane(this->ClippingPlanes[static_cast<int>(dev)]); + auto* mapper = actor->GetMapper(); + if (mapper) + { + mapper->AddClippingPlane(this->ClippingPlanes[static_cast<int>(dev)]); + } + return; } - return; - } - auto* volume = vtkVolume::SafeDownCast(prop); - if (volume) - { - auto* mapper = volume->GetMapper(); - if (mapper) + auto* volume = vtkVolume::SafeDownCast(prop); + if (volume) { - mapper->AddClippingPlane(this->ClippingPlanes[static_cast<int>(dev)]); + auto* mapper = volume->GetMapper(); + if (mapper) + { + mapper->AddClippingPlane(this->ClippingPlanes[static_cast<int>(dev)]); + } + return; } - return; - } - }); + }); } else { @@ -515,17 +517,19 @@ void vtkVRInteractorStyle::EndClip(vtkEventDataDevice3D* ed) if (this->CurrentRenderer != nullptr) { - ForEachNonWidgetProp(this->CurrentRenderer, [this, dev](vtkProp* prop) { - auto* actor = vtkActor::SafeDownCast(prop); - if (actor) + ForEachNonWidgetProp(this->CurrentRenderer, + [this, dev](vtkProp* prop) { - auto* mapper = actor->GetMapper(); - if (mapper) + auto* actor = vtkActor::SafeDownCast(prop); + if (actor) { - mapper->RemoveClippingPlane(this->ClippingPlanes[static_cast<int>(dev)]); + auto* mapper = actor->GetMapper(); + if (mapper) + { + mapper->RemoveClippingPlane(this->ClippingPlanes[static_cast<int>(dev)]); + } } - } - }); + }); } else { diff --git a/Rendering/Volume/vtkUnstructuredGridVolumeZSweepMapper.cxx b/Rendering/Volume/vtkUnstructuredGridVolumeZSweepMapper.cxx index 0172ad7afee..bce6648dcd9 100644 --- a/Rendering/Volume/vtkUnstructuredGridVolumeZSweepMapper.cxx +++ b/Rendering/Volume/vtkUnstructuredGridVolumeZSweepMapper.cxx @@ -27,7 +27,7 @@ #include "vtkCellArray.h" #include "vtkPolyData.h" -//#include "vtkXMLPolyDataWriter.h" +// #include "vtkXMLPolyDataWriter.h" #include "vtkPointData.h" #include <cassert> @@ -36,7 +36,7 @@ #include <vector> // do not remove the following line: -//#define BACK_TO_FRONT +// #define BACK_TO_FRONT // Put the internal classes in a namespace to avoid potential naming conflicts. namespace vtkUnstructuredGridVolumeZSweepMapperNamespace @@ -241,7 +241,7 @@ enum #define MOST_SIGNIFICANT #define EDGE_EQUATION #define HORI_EDGE_EQUATION -//#define STRICTLY_INSIDE +// #define STRICTLY_INSIDE class vtkSimpleScreenEdge : public vtkScreenEdge { diff --git a/Rendering/VolumeOpenGL2/Testing/Cxx/TestGPURayCastDepthPeelingBoxWidget.cxx b/Rendering/VolumeOpenGL2/Testing/Cxx/TestGPURayCastDepthPeelingBoxWidget.cxx index ba6a982a94c..e8c7502d077 100644 --- a/Rendering/VolumeOpenGL2/Testing/Cxx/TestGPURayCastDepthPeelingBoxWidget.cxx +++ b/Rendering/VolumeOpenGL2/Testing/Cxx/TestGPURayCastDepthPeelingBoxWidget.cxx @@ -1417,7 +1417,7 @@ int TestGPURayCastDepthPeelingBoxWidget(int argc, char* argv[]) iren->Initialize(); renWin->Render(); -//#define RECORD +// #define RECORD #ifdef RECORD recorder->SetFileName("/tmp/events.log"); recorder->Record(); diff --git a/Rendering/VolumeOpenGL2/vtkOpenGLGPUVolumeRayCastMapper.cxx b/Rendering/VolumeOpenGL2/vtkOpenGLGPUVolumeRayCastMapper.cxx index 711c7e24eb3..8e384df34f3 100644 --- a/Rendering/VolumeOpenGL2/vtkOpenGLGPUVolumeRayCastMapper.cxx +++ b/Rendering/VolumeOpenGL2/vtkOpenGLGPUVolumeRayCastMapper.cxx @@ -1069,9 +1069,8 @@ bool vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::IsGeometryUpdateRequired( const auto GeomTime = this->BBoxPolyData->GetMTime(); const bool uploadTimeChanged = any_of(this->Parent->AssembledInputs.begin(), this->Parent->AssembledInputs.end(), - [&GeomTime](const std::pair<int, vtkVolumeInputHelper>& item) { - return item.second.Texture->UploadTime > GeomTime; - }); + [&GeomTime](const std::pair<int, vtkVolumeInputHelper>& item) + { return item.second.Texture->UploadTime > GeomTime; }); return (this->NeedToInitializeResources || uploadTimeChanged || this->IsCameraInside(ren, vol, geometry) || this->CameraWasInsideInLastUpdate || diff --git a/Rendering/VolumeOpenGL2/vtkOpenGLProjectedTetrahedraMapper.cxx b/Rendering/VolumeOpenGL2/vtkOpenGLProjectedTetrahedraMapper.cxx index dde618c57b0..a029b3fb8c1 100644 --- a/Rendering/VolumeOpenGL2/vtkOpenGLProjectedTetrahedraMapper.cxx +++ b/Rendering/VolumeOpenGL2/vtkOpenGLProjectedTetrahedraMapper.cxx @@ -1007,7 +1007,8 @@ void vtkOpenGLProjectedTetrahedraMapper::ProjectTetrahedra( } // add the points to the VBO - union { + union + { unsigned char c[4]; float f; } v = { { 0, 0, 0, 255 } }; diff --git a/Rendering/WebGPU/Private/vtkWebGPUComputePassBufferStorageInternals.cxx b/Rendering/WebGPU/Private/vtkWebGPUComputePassBufferStorageInternals.cxx index a9f34c8fdeb..c22bb065bb8 100644 --- a/Rendering/WebGPU/Private/vtkWebGPUComputePassBufferStorageInternals.cxx +++ b/Rendering/WebGPU/Private/vtkWebGPUComputePassBufferStorageInternals.cxx @@ -255,7 +255,8 @@ void vtkWebGPUComputePassBufferStorageInternals::ReadBufferFromGPU( this->WebGPUBuffers[bufferIndex], 0, internalCallbackData->buffer, 0, byteSize); this->ParentComputePass->Internals->SubmitCommandEncoderToQueue(commandEncoder); - auto internalCallback = [](WGPUBufferMapAsyncStatus status, void* wgpuUserData) { + auto internalCallback = [](WGPUBufferMapAsyncStatus status, void* wgpuUserData) + { InternalMapBufferAsyncData* callbackData = reinterpret_cast<InternalMapBufferAsyncData*>(wgpuUserData); diff --git a/Rendering/WebGPU/Private/vtkWebGPUComputePassTextureStorageInternals.cxx b/Rendering/WebGPU/Private/vtkWebGPUComputePassTextureStorageInternals.cxx index 5f4235949e0..e5a7bac5c87 100644 --- a/Rendering/WebGPU/Private/vtkWebGPUComputePassTextureStorageInternals.cxx +++ b/Rendering/WebGPU/Private/vtkWebGPUComputePassTextureStorageInternals.cxx @@ -723,9 +723,8 @@ void vtkWebGPUComputePassTextureStorageInternals::DeleteTextureViews(std::size_t // Now removing the bind group layout entry that corresponded to the texture view bglLayoutEntries.erase(std::remove_if(bglLayoutEntries.begin(), bglLayoutEntries.end(), - [binding](const wgpu::BindGroupLayoutEntry& entry) -> bool { - return entry.binding == binding; - }), + [binding](const wgpu::BindGroupLayoutEntry& entry) -> bool + { return entry.binding == binding; }), bglLayoutEntries.end()); } } @@ -868,7 +867,8 @@ void vtkWebGPUComputePassTextureStorageInternals::ReadTextureFromGPU(std::size_t wgpu::CommandBuffer commandBuffer = commandEncoder.Finish(); this->ParentPassWGPUConfiguration->GetDevice().GetQueue().Submit(1, &commandBuffer); - auto bufferMapCallback = [](WGPUBufferMapAsyncStatus status, void* userdata2) { + auto bufferMapCallback = [](WGPUBufferMapAsyncStatus status, void* userdata2) + { InternalMapTextureAsyncData* mapData = reinterpret_cast<InternalMapTextureAsyncData*>(userdata2); diff --git a/Rendering/WebGPU/Testing/Cxx/TestComputePass.cxx b/Rendering/WebGPU/Testing/Cxx/TestComputePass.cxx index cb0b9cf75ef..8648a3704fb 100644 --- a/Rendering/WebGPU/Testing/Cxx/TestComputePass.cxx +++ b/Rendering/WebGPU/Testing/Cxx/TestComputePass.cxx @@ -88,7 +88,8 @@ int TestComputePass(int, char*[]) std::vector<OutputDataType> outputData; outputData.resize(DATA_SIZE); - auto onBufferMapped = [](const void* mappedData, void* userdata) { + auto onBufferMapped = [](const void* mappedData, void* userdata) + { std::vector<OutputDataType>* out = reinterpret_cast<std::vector<OutputDataType>*>(userdata); vtkIdType elementCount = out->size(); diff --git a/Rendering/WebGPU/Testing/Cxx/TestComputePassChained.cxx b/Rendering/WebGPU/Testing/Cxx/TestComputePassChained.cxx index e7921942410..16e350fe976 100644 --- a/Rendering/WebGPU/Testing/Cxx/TestComputePassChained.cxx +++ b/Rendering/WebGPU/Testing/Cxx/TestComputePassChained.cxx @@ -103,7 +103,8 @@ int TestComputePassChained(int, char*[]) std::vector<float> outputData; outputData.resize(DATA_SIZE); - auto onBufferMapped = [](const void* mappedData, void* userdata) { + auto onBufferMapped = [](const void* mappedData, void* userdata) + { std::vector<float>* out = reinterpret_cast<std::vector<float>*>(userdata); vtkIdType elementCount = out->size(); diff --git a/Rendering/WebGPU/Testing/Cxx/TestComputePassUniform.cxx b/Rendering/WebGPU/Testing/Cxx/TestComputePassUniform.cxx index caa1328a106..ff28365133f 100644 --- a/Rendering/WebGPU/Testing/Cxx/TestComputePassUniform.cxx +++ b/Rendering/WebGPU/Testing/Cxx/TestComputePassUniform.cxx @@ -101,7 +101,8 @@ int TestComputePassUniform(int, char*[]) std::vector<OutputDataType> outputData; outputData.resize(DATA_SIZE); - auto onBufferMapped = [](const void* mappedData, void* userdata) { + auto onBufferMapped = [](const void* mappedData, void* userdata) + { std::vector<OutputDataType>* out = reinterpret_cast<std::vector<OutputDataType>*>(userdata); vtkIdType elementCount = out->size(); diff --git a/Rendering/WebGPU/Testing/Cxx/TestComputePipeline.cxx b/Rendering/WebGPU/Testing/Cxx/TestComputePipeline.cxx index f5538837085..833f4896878 100644 --- a/Rendering/WebGPU/Testing/Cxx/TestComputePipeline.cxx +++ b/Rendering/WebGPU/Testing/Cxx/TestComputePipeline.cxx @@ -83,7 +83,8 @@ int TestComputePipeline(int, char*[]) std::vector<OutputDataType> outputData; outputData.resize(::DATA_SIZE); - auto onBufferMapped = [](const void* mappedData, void* userdata) { + auto onBufferMapped = [](const void* mappedData, void* userdata) + { std::vector<OutputDataType>* out = reinterpret_cast<std::vector<OutputDataType>*>(userdata); vtkIdType elementCount = out->size(); diff --git a/Rendering/WebGPU/Testing/Cxx/TestComputePipelineRelease.cxx b/Rendering/WebGPU/Testing/Cxx/TestComputePipelineRelease.cxx index 5cc1e6c2d33..71f81b3783a 100644 --- a/Rendering/WebGPU/Testing/Cxx/TestComputePipelineRelease.cxx +++ b/Rendering/WebGPU/Testing/Cxx/TestComputePipelineRelease.cxx @@ -98,7 +98,8 @@ int TestComputePipelineRelease(int, char*[]) std::vector<float> outputData; outputData.resize(::DATA_SIZE); - auto onBufferMapped = [](const void* mappedData, void* userdata) { + auto onBufferMapped = [](const void* mappedData, void* userdata) + { std::vector<float>* out = reinterpret_cast<std::vector<float>*>(userdata); vtkIdType elementCount = out->size(); diff --git a/Rendering/WebGPU/Testing/Cxx/TestComputePipelineUniform.cxx b/Rendering/WebGPU/Testing/Cxx/TestComputePipelineUniform.cxx index 6387f22b6d5..01e703ec17c 100644 --- a/Rendering/WebGPU/Testing/Cxx/TestComputePipelineUniform.cxx +++ b/Rendering/WebGPU/Testing/Cxx/TestComputePipelineUniform.cxx @@ -95,7 +95,8 @@ int TestComputePipelineUniform(int, char*[]) std::vector<OutputDataType> outputData; outputData.resize(::DATA_SIZE); - auto onBufferMapped = [](const void* mappedData, void* userdata) { + auto onBufferMapped = [](const void* mappedData, void* userdata) + { std::vector<OutputDataType>* out = reinterpret_cast<std::vector<OutputDataType>*>(userdata); vtkIdType elementCount = out->size(); diff --git a/Rendering/WebGPU/Testing/Cxx/TestComputeTexture.cxx b/Rendering/WebGPU/Testing/Cxx/TestComputeTexture.cxx index ab168d0a90b..2137ba7fe14 100644 --- a/Rendering/WebGPU/Testing/Cxx/TestComputeTexture.cxx +++ b/Rendering/WebGPU/Testing/Cxx/TestComputeTexture.cxx @@ -86,7 +86,8 @@ int TestComputeTexture(int, char*[]) std::vector<unsigned char> outputData( TEXTURE_HEIGHT * TEXTURE_WIDTH * outputTexture->GetBytesPerPixel()); - auto onTextureMapped = [](const void* mappedData, int bytesPerRow, void* userdata) { + auto onTextureMapped = [](const void* mappedData, int bytesPerRow, void* userdata) + { CallbackData* data = reinterpret_cast<CallbackData*>(userdata); std::vector<unsigned char>* outputData2 = data->outputData; const unsigned char* mappedDataChar = reinterpret_cast<const unsigned char*>(mappedData); diff --git a/Rendering/WebGPU/vtkWebGPUConfiguration.cxx b/Rendering/WebGPU/vtkWebGPUConfiguration.cxx index 25687ef093e..52c08a628f8 100644 --- a/Rendering/WebGPU/vtkWebGPUConfiguration.cxx +++ b/Rendering/WebGPU/vtkWebGPUConfiguration.cxx @@ -168,9 +168,8 @@ void vtkWebGPUConfiguration::AcquireAdapter( opts.defaultQueue.label = label.c_str(); #if defined(__EMSCRIPTEN__) // XXX(emwebgpu-update) Remove this ifdef after emscripten's webgpu.h catches up. - opts.deviceLostCallback = [](WGPUDeviceLostReason reason, char const* message, void* userdata) { - return vtkWebGPUCallbacksInternals::DeviceLostCallback(nullptr, reason, message, userdata); - }; + opts.deviceLostCallback = [](WGPUDeviceLostReason reason, char const* message, void* userdata) + { return vtkWebGPUCallbacksInternals::DeviceLostCallback(nullptr, reason, message, userdata); }; opts.deviceLostUserdata = nullptr; #else opts.deviceLostCallbackInfo.nextInChain = nullptr; diff --git a/Rendering/WebGPU/vtkWebGPUHardwareSelector.cxx b/Rendering/WebGPU/vtkWebGPUHardwareSelector.cxx index 09290baa1c0..888b4987158 100644 --- a/Rendering/WebGPU/vtkWebGPUHardwareSelector.cxx +++ b/Rendering/WebGPU/vtkWebGPUHardwareSelector.cxx @@ -7,7 +7,7 @@ #include "vtkRenderWindow.h" #include "vtkRenderer.h" -//#define vtkWebGPUHardwareSelectorDEBUG +// #define vtkWebGPUHardwareSelectorDEBUG #ifdef vtkWebGPUHardwareSelectorDEBUG #include "vtkImageImport.h" #include "vtkNew.h" diff --git a/Rendering/WebGPU/vtkWebGPUHelpers.cxx b/Rendering/WebGPU/vtkWebGPUHelpers.cxx index 495cb1943af..167202d000a 100644 --- a/Rendering/WebGPU/vtkWebGPUHelpers.cxx +++ b/Rendering/WebGPU/vtkWebGPUHelpers.cxx @@ -32,96 +32,97 @@ void vtkWebGPUHelpers::WriteComputeTextureToDisk(const std::string& filepath, // Callback for the data is mapped to copy the texture data in the std::vector vtkWebGPUComputePass::TextureMapAsyncCallback writeTextureToDiskCallback = - [](const void* mappedTexture, int bytesPerRow, void* userdata) { - MapTextureData* mapData = reinterpret_cast<MapTextureData*>(userdata); + [](const void* mappedTexture, int bytesPerRow, void* userdata) + { + MapTextureData* mapData = reinterpret_cast<MapTextureData*>(userdata); + + vtkNew<vtkImageData> pixelData; + pixelData->SetDimensions(mapData->width, mapData->height, 1); + pixelData->AllocateScalars(VTK_UNSIGNED_CHAR, 4); + for (int y = 0; y < mapData->height; y++) + { + int yIndex = y; + if (mapData->flipY) + { + yIndex = mapData->height - 1 - y; + } - vtkNew<vtkImageData> pixelData; - pixelData->SetDimensions(mapData->width, mapData->height, 1); - pixelData->AllocateScalars(VTK_UNSIGNED_CHAR, 4); - for (int y = 0; y < mapData->height; y++) + for (int x = 0; x < mapData->width; x++) { - int yIndex = y; - if (mapData->flipY) - { - yIndex = mapData->height - 1 - y; - } + unsigned char* pixel = + static_cast<unsigned char*>(pixelData->GetScalarPointer(x, yIndex, 0)); + int indexPadded = y * (bytesPerRow / 4) + x; - for (int x = 0; x < mapData->width; x++) + switch (mapData->dataType) { - unsigned char* pixel = - static_cast<unsigned char*>(pixelData->GetScalarPointer(x, yIndex, 0)); - int indexPadded = y * (bytesPerRow / 4) + x; - - switch (mapData->dataType) + case VTK_FLOAT: { - case VTK_FLOAT: + const float* mappedDataFloat = static_cast<const float*>(mappedTexture); + + switch (mapData->nbComponents) { - const float* mappedDataFloat = static_cast<const float*>(mappedTexture); - - switch (mapData->nbComponents) - { - case 4: - pixel[0] = static_cast<unsigned char>(mappedDataFloat[indexPadded * 4 + 0] * 255); - pixel[1] = static_cast<unsigned char>(mappedDataFloat[indexPadded * 4 + 1] * 255); - pixel[2] = static_cast<unsigned char>(mappedDataFloat[indexPadded * 4 + 2] * 255); - pixel[3] = static_cast<unsigned char>(mappedDataFloat[indexPadded * 4 + 3] * 255); - break; - - case 1: - pixel[0] = static_cast<unsigned char>(mappedDataFloat[indexPadded * 1 + 0] * 255); - pixel[1] = pixel[0]; - pixel[2] = pixel[0]; - pixel[3] = 255; - break; - - default: - break; - } - - break; + case 4: + pixel[0] = static_cast<unsigned char>(mappedDataFloat[indexPadded * 4 + 0] * 255); + pixel[1] = static_cast<unsigned char>(mappedDataFloat[indexPadded * 4 + 1] * 255); + pixel[2] = static_cast<unsigned char>(mappedDataFloat[indexPadded * 4 + 2] * 255); + pixel[3] = static_cast<unsigned char>(mappedDataFloat[indexPadded * 4 + 3] * 255); + break; + + case 1: + pixel[0] = static_cast<unsigned char>(mappedDataFloat[indexPadded * 1 + 0] * 255); + pixel[1] = pixel[0]; + pixel[2] = pixel[0]; + pixel[3] = 255; + break; + + default: + break; } - case VTK_UNSIGNED_CHAR: + break; + } + + case VTK_UNSIGNED_CHAR: + { + const unsigned char* mappedDataUnsignedChar = + static_cast<const unsigned char*>(mappedTexture); + + switch (mapData->nbComponents) { - const unsigned char* mappedDataUnsignedChar = - static_cast<const unsigned char*>(mappedTexture); - - switch (mapData->nbComponents) - { - case 4: - pixel[0] = mappedDataUnsignedChar[indexPadded * 4 + 0]; - pixel[1] = mappedDataUnsignedChar[indexPadded * 4 + 1]; - pixel[2] = mappedDataUnsignedChar[indexPadded * 4 + 2]; - pixel[3] = mappedDataUnsignedChar[indexPadded * 4 + 3]; - break; - - case 1: - pixel[0] = mappedDataUnsignedChar[indexPadded * 1 + 0]; - pixel[1] = pixel[0]; - pixel[2] = pixel[0]; - pixel[3] = 255; - break; - - default: - break; - } - - break; + case 4: + pixel[0] = mappedDataUnsignedChar[indexPadded * 4 + 0]; + pixel[1] = mappedDataUnsignedChar[indexPadded * 4 + 1]; + pixel[2] = mappedDataUnsignedChar[indexPadded * 4 + 2]; + pixel[3] = mappedDataUnsignedChar[indexPadded * 4 + 3]; + break; + + case 1: + pixel[0] = mappedDataUnsignedChar[indexPadded * 1 + 0]; + pixel[1] = pixel[0]; + pixel[2] = pixel[0]; + pixel[3] = 255; + break; + + default: + break; } - default: - break; + break; } + + default: + break; } } + } - vtkNew<vtkPNGWriter> writer; - writer->SetFileName(mapData->filepath.c_str()); - writer->SetInputData(pixelData); - writer->Write(); + vtkNew<vtkPNGWriter> writer; + writer->SetFileName(mapData->filepath.c_str()); + writer->SetInputData(pixelData); + writer->Write(); - delete mapData; - }; + delete mapData; + }; vtkSmartPointer<vtkWebGPUComputeTexture> texture = computePass->GetComputeTexture(textureIndex); diff --git a/Rendering/WebGPU/vtkWebGPURenderWindow.cxx b/Rendering/WebGPU/vtkWebGPURenderWindow.cxx index bfc8c3e4447..8472d9490aa 100644 --- a/Rendering/WebGPU/vtkWebGPURenderWindow.cxx +++ b/Rendering/WebGPU/vtkWebGPURenderWindow.cxx @@ -1009,7 +1009,8 @@ void vtkWebGPURenderWindow::ReadPixels() this->BufferMapReadContext.dst = this->CachedPixelBytes; this->BufferMapReadContext.window = this; - auto onBufferMapped = [](WGPUBufferMapAsyncStatus status, void* userdata) { + auto onBufferMapped = [](WGPUBufferMapAsyncStatus status, void* userdata) + { auto ctx = reinterpret_cast<MappingContext*>(userdata); if (ctx == nullptr) { diff --git a/Rendering/ZSpace/vtkZSpaceCoreCompatibilitySDKManager.cxx b/Rendering/ZSpace/vtkZSpaceCoreCompatibilitySDKManager.cxx index 6947e81cf64..3e47e219d00 100644 --- a/Rendering/ZSpace/vtkZSpaceCoreCompatibilitySDKManager.cxx +++ b/Rendering/ZSpace/vtkZSpaceCoreCompatibilitySDKManager.cxx @@ -386,9 +386,9 @@ void vtkZSpaceCoreCompatibilitySDKManager::UpdateButtonState() this->EntryPts.zccompatIsTargetButtonPressed(this->StylusHandle, buttonId, &isButtonPressed); ButtonState& buttonState = *this->ButtonsState[buttonId]; - buttonState = isButtonPressed - ? buttonState != vtkZSpaceSDKManager::Pressed ? vtkZSpaceSDKManager::Down - : vtkZSpaceSDKManager::Pressed + buttonState = isButtonPressed ? buttonState != vtkZSpaceSDKManager::Pressed + ? vtkZSpaceSDKManager::Down + : vtkZSpaceSDKManager::Pressed : buttonState != vtkZSpaceSDKManager::None ? vtkZSpaceSDKManager::Up : vtkZSpaceSDKManager::None; } diff --git a/Rendering/ZSpace/vtkZSpaceCoreSDKManager.cxx b/Rendering/ZSpace/vtkZSpaceCoreSDKManager.cxx index 11ba4c841b4..11f7463c473 100644 --- a/Rendering/ZSpace/vtkZSpaceCoreSDKManager.cxx +++ b/Rendering/ZSpace/vtkZSpaceCoreSDKManager.cxx @@ -262,9 +262,9 @@ void vtkZSpaceCoreSDKManager::UpdateButtonState() ZSPACE_CHECK_ERROR(zcIsTargetButtonPressed, error); ButtonState& buttonState = *this->ButtonsState[buttonId]; - buttonState = isButtonPressed - ? buttonState != vtkZSpaceSDKManager::Pressed ? vtkZSpaceSDKManager::Down - : vtkZSpaceSDKManager::Pressed + buttonState = isButtonPressed ? buttonState != vtkZSpaceSDKManager::Pressed + ? vtkZSpaceSDKManager::Down + : vtkZSpaceSDKManager::Pressed : buttonState != vtkZSpaceSDKManager::None ? vtkZSpaceSDKManager::Up : vtkZSpaceSDKManager::None; } diff --git a/Serialization/Manager/vtkObjectManager.cxx b/Serialization/Manager/vtkObjectManager.cxx index 46584553fd5..7cf96f22e2a 100644 --- a/Serialization/Manager/vtkObjectManager.cxx +++ b/Serialization/Manager/vtkObjectManager.cxx @@ -468,7 +468,8 @@ void vtkObjectManager::UpdateObjectsFromStates() nlohmann::json strongRefStates; const auto& states = this->Context->States(); std::copy_if(states.begin(), states.end(), std::back_inserter(strongRefStates), - [](const nlohmann::json& item) { + [](const nlohmann::json& item) + { return item.contains("vtk-object-manager-kept-alive") && item["vtk-object-manager-kept-alive"] == true; }); diff --git a/Testing/Core/Testing/Cxx/TestDataObjectCompare.cxx b/Testing/Core/Testing/Cxx/TestDataObjectCompare.cxx index 1e22e0e90eb..3456a23a59e 100644 --- a/Testing/Core/Testing/Cxx/TestDataObjectCompare.cxx +++ b/Testing/Core/Testing/Cxx/TestDataObjectCompare.cxx @@ -100,7 +100,8 @@ void ShrinkFieldData(vtkHyperTreeGrid* htg) //------------------------------------------------------------------------------ void TurnOffLogging(std::ostringstream& logStream) { - auto stream_sink = [](void* userData, const vtkLogger::Message& message) { + auto stream_sink = [](void* userData, const vtkLogger::Message& message) + { std::ostream& s = *reinterpret_cast<std::ostream*>(userData); s << message.preamble << message.message << std::endl; }; diff --git a/Testing/Core/vtkTestUtilities.cxx b/Testing/Core/vtkTestUtilities.cxx index a4949a37444..462f2ae68b6 100644 --- a/Testing/Core/vtkTestUtilities.cxx +++ b/Testing/Core/vtkTestUtilities.cxx @@ -362,7 +362,8 @@ struct GenericArrayWorker ArrayT1& array1Ref = this->Array1; ArrayT2& array2Ref = this->Array2; - auto execute = [this, &array1Ref, &array2Ref](vtkIdType id) { + auto execute = [this, &array1Ref, &array2Ref](vtkIdType id) + { this->Processor.template Execute<N>( this->Mapper1.Map(id), array1Ref, this->Mapper2.Map(id), array2Ref); }; @@ -811,7 +812,8 @@ struct PointMatchingWorker // when checking the cells. std::unordered_set<vtkIdType> pointIdCandidates, pointIdCandidatesSource; - auto initializer = [&pointIdCandidatesSource](bool equals, vtkIdType, vtkIdType id) { + auto initializer = [&pointIdCandidatesSource](bool equals, vtkIdType, vtkIdType id) + { if (equals) { pointIdCandidatesSource.insert(id); @@ -819,7 +821,8 @@ struct PointMatchingWorker }; auto intersector = [&pointIdCandidatesSource, &pointIdCandidates]( - bool equals, vtkIdType, vtkIdType id) { + bool equals, vtkIdType, vtkIdType id) + { if (equals) { auto it = pointIdCandidatesSource.find(id); @@ -929,7 +932,8 @@ struct DataSetPointMapper<vtkPointSet> DataSetPointMapper(vtkPointSet* ps1, vtkPointSet* ps2, double toleranceFactor) : Size(ps1->GetNumberOfPoints()) { - auto testValidInput = [](vtkPointSet* input) { + auto testValidInput = [](vtkPointSet* input) + { if (vtkPoints* points = input->GetPoints()) { if (!points->GetData()) @@ -959,7 +963,8 @@ struct DataSetPointMapper<vtkPointSet> } auto comparePoints = [this, &toleranceFactor]( - vtkPointSet* query, vtkPointSet* target, bool mapPoints) { + vtkPointSet* query, vtkPointSet* target, bool mapPoints) + { vtkNew<vtkStaticPointLocator> locator; locator->SetDataSet(target); locator->BuildLocator(); @@ -996,7 +1001,8 @@ bool TestAbstractArray(vtkAbstractArray* array1, vtkAbstractArray* array2, Array { std::atomic_bool success{ true }; - auto decider = [&success](bool equals, vtkIdType id1, vtkIdType id2) { + auto decider = [&success](bool equals, vtkIdType id1, vtkIdType id2) + { if (!equals) { vtkLog(ERROR, "Tuples mapped at id " << id1 << " and " << id2 << " do not match."); @@ -1047,8 +1053,9 @@ struct DataSetPointMapper<vtkImageData> : public StructuredDataSetMapper<vtkImag double origin1[3], origin2[3], spacing1[3], spacing2[3]; vtkQuaternion<double> q1, q2; - auto extractStructure = [](vtkImageData* im, double origin[3], double spacing[3], - vtkQuaternion<double>& q) { + auto extractStructure = + [](vtkImageData* im, double origin[3], double spacing[3], vtkQuaternion<double>& q) + { im->GetOrigin(origin); im->GetSpacing(spacing); vtkMatrix3x3* m = im->GetDirectionMatrix(); @@ -1084,7 +1091,8 @@ struct DataSetPointMapper<RectilinearGridT, return; } - auto extractStructure = [](RectilinearGridT* rg, vtkDataArray* coords[3]) { + auto extractStructure = [](RectilinearGridT* rg, vtkDataArray* coords[3]) + { coords[0] = rg->GetXCoordinates(); coords[1] = rg->GetYCoordinates(); coords[2] = rg->GetZCoordinates(); @@ -1115,7 +1123,8 @@ struct DataSetPointMapper<RectilinearGridT, using DataArrayDispatcher = vtkArrayDispatch::Dispatch2BySameValueType<vtkArrayDispatch::Reals>; vtkIdType errorId; - auto decider = [&errorId, this](bool equals, vtkIdType id, vtkIdType) { + auto decider = [&errorId, this](bool equals, vtkIdType id, vtkIdType) + { if (!equals) { vtkLog(ERROR, "Coords don't match at id " << id << "."); @@ -1297,7 +1306,8 @@ bool TestPoints(DataObjectT* ds1, DataObjectT* ds2, double toleranceFactor) //---------------------------------------------------------------------------- bool TestEdgeCenters(vtkPointSet* ps1, vtkPointSet* ps2, double toleranceFactor) { - auto computeEdgeCenters = [](vtkPointSet* ps) { + auto computeEdgeCenters = [](vtkPointSet* ps) + { vtkNew<vtkExtractEdges> edges; edges->SetInputData(ps); @@ -1351,7 +1361,8 @@ void GenerateNewRandomArrayName(std::string nameRoot, vtkAbstractArray* array1, void AddArrayCopyWithUniqueNameToFieldData(std::string nameRoot, vtkDataArray* array1, vtkDataArray* array2, vtkFieldData* fd1, vtkFieldData* fd2) { - auto impl = [](vtkDataArray* in) { + auto impl = [](vtkDataArray* in) + { auto out = vtkSmartPointer<vtkDataArray>::Take(in->NewInstance()); out->ShallowCopy(in); return out; @@ -1387,7 +1398,8 @@ void AddCellMetaDataToCellDataImpl(vtkUnstructuredGrid* out1, vtkUnstructuredGri void AddCellMetaDataToCellDataImpl(vtkPolyData* out1, vtkPolyData* out2) { // We need to generate a cell types array. - auto impl = [](vtkPolyData* out) { + auto impl = [](vtkPolyData* out) + { out->BuildCells(); vtkNew<vtkUnsignedCharArray> cellTypes; @@ -1395,8 +1407,9 @@ void AddCellMetaDataToCellDataImpl(vtkPolyData* out1, vtkPolyData* out2) auto array = vtk::DataArrayValueRange<1>(cellTypes); - vtkSMPTools::For( - 0, cellTypes->GetNumberOfValues(), [&array, &out](vtkIdType begin, vtkIdType end) { + vtkSMPTools::For(0, cellTypes->GetNumberOfValues(), + [&array, &out](vtkIdType begin, vtkIdType end) + { for (vtkIdType cellId = begin; cellId < end; ++cellId) { array[cellId] = out->GetCellType(cellId); @@ -1435,7 +1448,8 @@ template <class DataObjectT> std::pair<vtkSmartPointer<DataObjectT>, vtkSmartPointer<DataObjectT>> AddCellMetaDataToCellData( DataObjectT* in1, DataObjectT* in2) { - auto createOutput = [](DataObjectT* in) { + auto createOutput = [](DataObjectT* in) + { auto out = vtkSmartPointer<DataObjectT>::Take(in->NewInstance()); out->CopyStructure(in); out->ShallowCopy(in); @@ -1474,7 +1488,8 @@ struct CellsTester<DataObjectT, vtkSmartPointer<DataObjectT> enhancedDO1, enhancedDO2; std::tie(enhancedDO1, enhancedDO2) = AddCellMetaDataToCellData(do1, do2); - auto computeCellCenters = [](DataObjectT* ds) { + auto computeCellCenters = [](DataObjectT* ds) + { using CellCenters = typename DataObjectTraits<DataObjectT>::CellCenters; vtkNew<CellCenters> centers; diff --git a/Testing/GenericBridge/vtkBridgeExport.h b/Testing/GenericBridge/vtkBridgeExport.h index 11900e53308..a030c0c2a18 100644 --- a/Testing/GenericBridge/vtkBridgeExport.h +++ b/Testing/GenericBridge/vtkBridgeExport.h @@ -29,7 +29,7 @@ #define VTK_BRIDGE_EXPORT #endif -#endif //#if 1 +#endif // #if 1 #endif diff --git a/Testing/Rendering/vtkTesting.cxx b/Testing/Rendering/vtkTesting.cxx index 20ed34158b0..d02298b69d4 100644 --- a/Testing/Rendering/vtkTesting.cxx +++ b/Testing/Rendering/vtkTesting.cxx @@ -604,15 +604,18 @@ int vtkTesting::RegressionTest(vtkAlgorithm* imageSource, double thresh, ostream rtExtract->SetComponents(0, 1, 2); rtExtract->Update(); - auto createLegacyDiffFilter = [](vtkAlgorithm* source, vtkAlgorithm* extract) { + auto createLegacyDiffFilter = [](vtkAlgorithm* source, vtkAlgorithm* extract) + { auto alg = vtkSmartPointer<vtkAlgorithm>::Take(vtkImageDifference::New()); alg->SetInputConnection(source->GetOutputPort()); alg->SetInputConnection(1, extract->GetOutputPort()); return alg; }; - auto createSSIMFilter = [](vtkAlgorithm* source, vtkAlgorithm* extract) { - auto createPipeline = [](vtkAlgorithm* alg) { + auto createSSIMFilter = [](vtkAlgorithm* source, vtkAlgorithm* extract) + { + auto createPipeline = [](vtkAlgorithm* alg) + { vtkNew<vtkImageShiftScale> normalizer; vtkNew<vtkImageRGBToXYZ> rgb2xyz; vtkNew<vtkImageXYZToLAB> xyz2lab; @@ -670,8 +673,10 @@ int vtkTesting::RegressionTest(vtkAlgorithm* imageSource, double thresh, ostream NONE }; - int imageCompareMethod = [] { - auto imageCompareString = [] { + int imageCompareMethod = [] + { + auto imageCompareString = [] + { if (!vtksys::SystemTools::HasEnv("VTK_TESTING_IMAGE_COMPARE_METHOD")) { vtkLog(WARNING, "Environment variable VTK_TESTING_IMAGE_COMPARE_METHOD is not set."); @@ -700,7 +705,8 @@ int vtkTesting::RegressionTest(vtkAlgorithm* imageSource, double thresh, ostream auto rtId = imageCompareMethod == LEGACY ? createLegacyDiffFilter(ic1, ic2) : createSSIMFilter(ic1, ic2); - auto executeComparison = [&](double& err) { + auto executeComparison = [&](double& err) + { rtId->Update(); vtkDoubleArray* scalars = vtkArrayDownCast<vtkDoubleArray>( @@ -977,7 +983,8 @@ int vtkTesting::RegressionTest(vtkAlgorithm* imageSource, double thresh, ostream auto ssim = vtkImageData::SafeDownCast(rtId->GetOutputDataObject(0)); vtkDataSet* current = vtkDataSet::SafeDownCast(rtId->GetExecutive()->GetInputData(0, 0)); vtkDataSet* baseline = vtkDataSet::SafeDownCast(rtId->GetExecutive()->GetInputData(1, 0)); - auto addOriginalArray = [&ssim](vtkDataSet* ds, std::string&& name) { + auto addOriginalArray = [&ssim](vtkDataSet* ds, std::string&& name) + { vtkDataArray* scalars = ds->GetPointData()->GetScalars(); auto array = vtkSmartPointer<vtkDataArray>::Take(scalars->NewInstance()); array->ShallowCopy(scalars); diff --git a/Utilities/Benchmarks/vtkRenderTimings.cxx b/Utilities/Benchmarks/vtkRenderTimings.cxx index ce8657aa00f..4a691f54356 100644 --- a/Utilities/Benchmarks/vtkRenderTimings.cxx +++ b/Utilities/Benchmarks/vtkRenderTimings.cxx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: BSD-3-Clause #include "vtkRenderTimings.h" -//#include "vtkNew.h" +// #include "vtkNew.h" #include <vtksys/FStream.hxx> #include <vtksys/RegularExpression.hxx> diff --git a/Utilities/DICOMParser/DICOMAppHelper.cxx b/Utilities/DICOMParser/DICOMAppHelper.cxx index 6f1e9679d9b..d9344cce962 100644 --- a/Utilities/DICOMParser/DICOMAppHelper.cxx +++ b/Utilities/DICOMParser/DICOMAppHelper.cxx @@ -25,7 +25,7 @@ #include <mem.h> // for memcpy #endif -//#define DEBUG_DICOM_APP_HELPER +// #define DEBUG_DICOM_APP_HELPER VTK_ABI_NAMESPACE_BEGIN class DICOMAppHelperImplementation @@ -133,7 +133,7 @@ DICOMAppHelper::~DICOMAppHelper() // // Fix warning here. // - delete[](static_cast<char*>(this->ImageData)); + delete[] (static_cast<char*>(this->ImageData)); delete this->TransferSyntaxUID; delete this->PhotometricInterpretation; @@ -816,7 +816,7 @@ void DICOMAppHelper::PixelDataCallback( std::cout << "Slope and offset are not integer valued : "; std::cout << this->RescaleSlope << ", " << this->RescaleOffset << std::endl; #endif - delete[](static_cast<char*>(this->ImageData)); + delete[] (static_cast<char*>(this->ImageData)); this->ImageData = new float[numPixels]; floatOutputData = static_cast<float*>(this->ImageData); @@ -861,7 +861,7 @@ void DICOMAppHelper::PixelDataCallback( if (ptrIncr == 1) { - delete[](static_cast<char*>(this->ImageData)); + delete[] (static_cast<char*>(this->ImageData)); this->ImageData = new char[numPixels]; char* charOutputData = static_cast<char*>(this->ImageData); @@ -884,7 +884,7 @@ void DICOMAppHelper::PixelDataCallback( } else if (ptrIncr == 2) { - delete[](static_cast<char*>(this->ImageData)); + delete[] (static_cast<char*>(this->ImageData)); this->ImageData = new short[numPixels]; short* shortOutputData = static_cast<short*>(this->ImageData); diff --git a/Utilities/DICOMParser/DICOMFile.cxx b/Utilities/DICOMParser/DICOMFile.cxx index 2f51917be3b..e1d4692e764 100644 --- a/Utilities/DICOMParser/DICOMFile.cxx +++ b/Utilities/DICOMParser/DICOMFile.cxx @@ -21,7 +21,8 @@ VTK_ABI_NAMESPACE_BEGIN DICOMFile::DICOMFile() { /* Are we little or big endian? From Harbison&Steele. */ - union { + union + { long l; char c[sizeof(long)]; } u; diff --git a/Utilities/PythonInterpreter/vtkPythonInterpreter.cxx b/Utilities/PythonInterpreter/vtkPythonInterpreter.cxx index 1e9b6e12145..928c3ddbe3e 100644 --- a/Utilities/PythonInterpreter/vtkPythonInterpreter.cxx +++ b/Utilities/PythonInterpreter/vtkPythonInterpreter.cxx @@ -782,9 +782,8 @@ int vtkPythonInterpreter::PyMain(int argc, char** argv) PyObject* minor = PyObject_GetAttrString(version_info, "minor"); PyObject* micro = PyObject_GetAttrString(version_info, "micro"); - auto py_number_cmp = [](PyObject* obj, long expected) { - return obj && PyLong_Check(obj) && PyLong_AsLong(obj) == expected; - }; + auto py_number_cmp = [](PyObject* obj, long expected) + { return obj && PyLong_Check(obj) && PyLong_AsLong(obj) == expected; }; // Only 3.7.0 has this issue. Any failures to get the version // information is OK; we'll just crash later anyways if the version is diff --git a/Views/Infovis/Testing/Cxx/TestInteractorStyleTreeMapHover.cxx b/Views/Infovis/Testing/Cxx/TestInteractorStyleTreeMapHover.cxx index 12730ee649c..1dc1867eb7e 100644 --- a/Views/Infovis/Testing/Cxx/TestInteractorStyleTreeMapHover.cxx +++ b/Views/Infovis/Testing/Cxx/TestInteractorStyleTreeMapHover.cxx @@ -573,7 +573,7 @@ static char InteractorStyleTreeMapHoverEventLog[] = "RenderEvent 169 213 0 0 0 0 Control_L\n" "MouseMoveEvent 169 213 0 0 0 0 Control_L\n"; -//#define RECORD +// #define RECORD int TestInteractorStyleTreeMapHover(int argc, char* argv[]) { diff --git a/Views/Infovis/Testing/Cxx/TestRenderView.cxx b/Views/Infovis/Testing/Cxx/TestRenderView.cxx index 19381dc8203..9da539fbc12 100644 --- a/Views/Infovis/Testing/Cxx/TestRenderView.cxx +++ b/Views/Infovis/Testing/Cxx/TestRenderView.cxx @@ -1044,7 +1044,7 @@ static char RenderViewEventLog[] = "# StreamVersion 1\n" "LeaveEvent 251 299 0 0 0 0 0\n" "ExitEvent 251 299 0 0 0 0 0\n"; -//#define RECORD +// #define RECORD int TestRenderView(int, char*[]) { diff --git a/Views/Infovis/vtkDendrogramItem.cxx b/Views/Infovis/vtkDendrogramItem.cxx index cbdde04003f..bc057ff95e8 100644 --- a/Views/Infovis/vtkDendrogramItem.cxx +++ b/Views/Infovis/vtkDendrogramItem.cxx @@ -697,8 +697,8 @@ void vtkDendrogramItem::PaintBuffers(vtkContext2D* painter) } std::string vertexName = vertexNames->GetValue(vertex); - if (this->SceneBottomLeft[0] < xStart && this->SceneTopRight[0] > xStart && - this->SceneBottomLeft[1] < yStart && this->SceneTopRight[1] > yStart) + if (this->SceneBottomLeft[0]<xStart&& this->SceneTopRight[0]> xStart && + this->SceneBottomLeft[1]<yStart&& this->SceneTopRight[1]> yStart) { painter->DrawString(xStart, yStart, vertexName); } diff --git a/Views/Infovis/vtkHeatmapItem.cxx b/Views/Infovis/vtkHeatmapItem.cxx index 5d0be31f477..32d715361ab 100644 --- a/Views/Infovis/vtkHeatmapItem.cxx +++ b/Views/Infovis/vtkHeatmapItem.cxx @@ -582,9 +582,9 @@ void vtkHeatmapItem::PaintBuffers(vtkContext2D* painter) break; } - if (!name.empty() && this->SceneBottomLeft[0] < labelStartX && - this->SceneTopRight[0] > labelStartX && this->SceneBottomLeft[1] < labelStartY && - this->SceneTopRight[1] > labelStartY) + if (!name.empty() && + this->SceneBottomLeft[0]<labelStartX&& this->SceneTopRight[0]> labelStartX && + this->SceneBottomLeft[1]<labelStartY&& this->SceneTopRight[1]> labelStartY) { painter->DrawString(labelStartX, labelStartY, name); } @@ -664,8 +664,8 @@ void vtkHeatmapItem::PaintBuffers(vtkContext2D* painter) } std::string columnName = this->Table->GetColumn(column)->GetName(); - if (this->SceneBottomLeft[0] < labelStartX && this->SceneTopRight[0] > labelStartX && - this->SceneBottomLeft[1] < labelStartY && this->SceneTopRight[1] > labelStartY) + if (this->SceneBottomLeft[0]<labelStartX&& this->SceneTopRight[0]> labelStartX && + this->SceneBottomLeft[1]<labelStartY&& this->SceneTopRight[1]> labelStartY) { painter->DrawString(labelStartX, labelStartY, columnName); } diff --git a/Web/Core/vtkDataEncoder.cxx b/Web/Core/vtkDataEncoder.cxx index b554b940d21..e93ca58f7b1 100644 --- a/Web/Core/vtkDataEncoder.cxx +++ b/Web/Core/vtkDataEncoder.cxx @@ -197,17 +197,19 @@ public: } const auto& ts = tsIter->second; std::unique_lock<std::mutex> lock(this->ResultsMutex); - this->ResultsCondition.wait(lock, [this, &ts, &key]() { - try + this->ResultsCondition.wait(lock, + [this, &ts, &key]() { - return ts == this->Results[key].first; - } - catch (std::out_of_range&) - { - // result not available yet; keep waiting; - return false; - } - }); + try + { + return ts == this->Results[key].first; + } + catch (std::out_of_range&) + { + // result not available yet; keep waiting; + return false; + } + }); } }; VTK_ABI_NAMESPACE_END diff --git a/Web/WebAssembly/vtkWasmSceneManager.cxx b/Web/WebAssembly/vtkWasmSceneManager.cxx index ecb70278c9e..9259a31880d 100644 --- a/Web/WebAssembly/vtkWasmSceneManager.cxx +++ b/Web/WebAssembly/vtkWasmSceneManager.cxx @@ -146,14 +146,18 @@ unsigned long vtkWasmSceneManager::AddObserver( } vtkNew<vtkCallbackCommand> callbackCmd; callbackCmd->SetClientData(new CallbackBridge{ callback, identifier }); - callbackCmd->SetClientDataDeleteCallback([](void* clientData) { - auto* bridge = reinterpret_cast<CallbackBridge*>(clientData); - delete bridge; - }); - callbackCmd->SetCallback([](vtkObject*, unsigned long eid, void* clientData, void*) { - auto* bridge = reinterpret_cast<CallbackBridge*>(clientData); - bridge->f(bridge->SenderId, vtkCommand::GetStringFromEventId(eid)); - }); + callbackCmd->SetClientDataDeleteCallback( + [](void* clientData) + { + auto* bridge = reinterpret_cast<CallbackBridge*>(clientData); + delete bridge; + }); + callbackCmd->SetCallback( + [](vtkObject*, unsigned long eid, void* clientData, void*) + { + auto* bridge = reinterpret_cast<CallbackBridge*>(clientData); + bridge->f(bridge->SenderId, vtkCommand::GetStringFromEventId(eid)); + }); return object->AddObserver(eventName.c_str(), callbackCmd); } diff --git a/Wrapping/PythonCore/vtkPythonArgs.cxx b/Wrapping/PythonCore/vtkPythonArgs.cxx index 8cdc3354554..d6bb976b37b 100644 --- a/Wrapping/PythonCore/vtkPythonArgs.cxx +++ b/Wrapping/PythonCore/vtkPythonArgs.cxx @@ -860,7 +860,10 @@ inline PyObject* vtkPythonBuildTuple(const T* a, size_t n) } #define VTK_PYTHON_BUILD_TUPLE(T) \ - PyObject* vtkPythonArgs::BuildTuple(const T* a, size_t n) { return vtkPythonBuildTuple(a, n); } + PyObject* vtkPythonArgs::BuildTuple(const T* a, size_t n) \ + { \ + return vtkPythonBuildTuple(a, n); \ + } VTK_PYTHON_BUILD_TUPLE(bool) VTK_PYTHON_BUILD_TUPLE(float) @@ -1083,7 +1086,10 @@ bool vtkPythonArgs::GetVTKObject(PyObject* o, vtkSmartPointerBase& v, const char return false; \ } \ \ - bool vtkPythonArgs::GetValue(PyObject* o, T& a) { return vtkPythonGetValue(o, a); } + bool vtkPythonArgs::GetValue(PyObject* o, T& a) \ + { \ + return vtkPythonGetValue(o, a); \ + } VTK_PYTHON_GET_ARG(const char*) VTK_PYTHON_GET_ARG(std::string) @@ -1121,7 +1127,10 @@ VTK_PYTHON_GET_ARG(unsigned long long) return false; \ } \ \ - bool vtkPythonArgs::GetFilePath(PyObject* o, T& a) { return vtkPythonGetFilePath(o, a); } + bool vtkPythonArgs::GetFilePath(PyObject* o, T& a) \ + { \ + return vtkPythonGetFilePath(o, a); \ + } VTK_PYTHON_GET_FILEPATH_ARG(const char*) VTK_PYTHON_GET_FILEPATH_ARG(std::string) diff --git a/Wrapping/PythonCore/vtkPythonUtil.cxx b/Wrapping/PythonCore/vtkPythonUtil.cxx index 6d38d526218..f401af3668b 100644 --- a/Wrapping/PythonCore/vtkPythonUtil.cxx +++ b/Wrapping/PythonCore/vtkPythonUtil.cxx @@ -695,14 +695,16 @@ vtkObjectBase* vtkPythonUtil::GetPointerFromObject(PyObject* obj, const char* re //---------------- // union of long int and pointer -union vtkPythonUtilPointerUnion { +union vtkPythonUtilPointerUnion +{ void* p; uintptr_t l; }; //---------------- // union of long int and pointer -union vtkPythonUtilConstPointerUnion { +union vtkPythonUtilConstPointerUnion +{ const void* p; uintptr_t l; }; -- GitLab