From 1d79c0452cd1d557cbbc5a51a46720fcc299e33b Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 29 Jul 2019 11:36:30 +0200 Subject: [PATCH] ENH: additional contiguous traits (#1378) - change contiguous from a series of global functions to separate templated traits classes: - is_contiguous - is_contiguous_label - is_contiguous_scalar The static constexpr 'value' and a constexpr conversion operator allow use in template expressions. The change also makes it much easier to define general traits and to inherit from them. The is_contiguous_label and is_contiguous_scalar are special traits for handling data of homogeneous components of the respective types. --- applications/test/Hashing/Test-Hashing.C | 18 +-- applications/test/List/Test-List.C | 4 +- applications/test/contiguous/Make/options | 7 +- .../test/contiguous/Test-contiguous.C | 54 +++++--- .../indexedCell/indexedCellEnum.C | 2 +- .../indexedCell/indexedCellEnum.H | 12 +- .../indexedVertex/indexedVertex.H | 28 ++-- .../indexedVertex/indexedVertexEnum.H | 16 ++- .../algorithms/indexedOctree/volumeType.H | 12 +- .../IndirectListBase/IndirectListBaseIO.C | 6 +- .../containers/Lists/FixedList/FixedList.H | 18 ++- .../containers/Lists/FixedList/FixedListIO.C | 7 +- src/OpenFOAM/containers/Lists/List/List.C | 10 +- src/OpenFOAM/containers/Lists/List/List.H | 2 +- src/OpenFOAM/containers/Lists/List/ListIO.C | 4 +- src/OpenFOAM/containers/Lists/UList/UList.C | 4 +- src/OpenFOAM/containers/Lists/UList/UList.H | 6 +- src/OpenFOAM/containers/Lists/UList/UListIO.C | 8 +- .../IOstreams/Pstreams/combineGatherScatter.C | 18 +-- src/OpenFOAM/db/IOstreams/Pstreams/exchange.C | 7 +- .../db/IOstreams/Pstreams/gatherScatter.C | 10 +- .../db/IOstreams/Pstreams/gatherScatterList.C | 10 +- src/OpenFOAM/fields/Fields/Field/Field.C | 2 +- .../pointConstraint/pointConstraint.H | 18 ++- src/OpenFOAM/matrices/Matrix/MatrixIO.C | 8 +- src/OpenFOAM/meshes/boundBox/boundBox.H | 16 ++- src/OpenFOAM/meshes/meshShapes/edge/edge.H | 14 +- .../meshShapes/labelledTri/labelledTri.H | 15 +- .../meshes/meshShapes/tetCell/tetCell.H | 15 +- .../meshes/meshShapes/triFace/triFace.H | 9 +- .../globalMeshData/globalIndexTemplates.C | 16 +-- .../mapDistributeBaseTemplates.C | 6 +- .../primitiveShapes/objectHit/pointIndexHit.H | 8 +- .../meshes/treeBoundBox/treeBoundBox.H | 15 +- .../primitives/Barycentric/Barycentric.H | 18 ++- .../Barycentric/BarycentricTensor.H | 23 +++- .../Barycentric/barycentric/barycentric.H | 16 +-- .../barycentricTensor/barycentricTensor.H | 11 +- .../primitives/Barycentric2D/Barycentric2D.H | 16 +++ .../barycentric2D/barycentric2D.H | 15 +- .../primitives/DiagTensor/DiagTensor.H | 18 ++- .../DiagTensor/diagTensor/diagTensor.H | 9 +- src/OpenFOAM/primitives/Pair/Pair.H | 21 ++- .../SphericalTensor/SphericalTensor.H | 25 +++- .../labelSphericalTensor.H | 8 +- .../sphericalTensor/sphericalTensor.H | 8 +- .../SphericalTensor2D/SphericalTensor2D.H | 27 +++- .../sphericalTensor2D/sphericalTensor2D.H | 9 +- .../primitives/SymmTensor/SymmTensor.H | 19 ++- .../labelSymmTensor/labelSymmTensor.H | 8 +- .../SymmTensor/symmTensor/symmTensor.H | 8 +- .../primitives/SymmTensor2D/SymmTensor2D.H | 19 ++- .../SymmTensor2D/symmTensor2D/symmTensor2D.H | 8 +- src/OpenFOAM/primitives/Tensor/Tensor.H | 17 ++- .../Tensor/doubleTensor/doubleTensor.H | 11 +- .../Tensor/floatTensor/floatTensor.H | 9 +- .../Tensor/labelTensor/labelTensor.H | 10 +- .../primitives/Tensor/tensor/tensor.H | 7 +- src/OpenFOAM/primitives/Tensor2D/Tensor2D.H | 22 ++- .../primitives/Tensor2D/tensor2D/tensor2D.H | 9 +- src/OpenFOAM/primitives/Vector/Vector.H | 18 ++- .../Vector/doubleVector/doubleVector.H | 9 +- .../Vector/floatVector/floatVector.H | 11 +- .../Vector/labelVector/labelVector.H | 9 +- .../primitives/Vector/vector/vector.H | 9 +- src/OpenFOAM/primitives/Vector2D/Vector2D.H | 19 ++- .../Vector2D/labelVector2D/labelVector2D.H | 7 - .../primitives/Vector2D/vector2D/vector2D.H | 9 +- src/OpenFOAM/primitives/complex/complex.H | 17 ++- .../primitives/contiguous/contiguous.H | 128 +++++++----------- .../vectorTensorTransform.H | 16 ++- .../primitives/quaternion/quaternion.H | 14 +- .../primitives/septernion/septernion.H | 21 +-- .../CompactSpatialTensor.H | 23 +++- .../compactSpatialTensor.H | 7 +- .../CompactSpatialTensorT.H | 23 +++- .../SpatialTensor/SpatialTensor.H | 24 +++- .../spatialTensor/spatialTensor.H | 7 +- .../SpatialVector/SpatialVector.H | 23 +++- .../spatialVector/spatialVector.H | 6 +- src/OpenFOAM/primitives/triad/triad.H | 18 ++- .../LES/LESdeltas/smoothDelta/smoothDelta.H | 16 +-- .../directions/directionInfo/directionInfo.H | 20 ++- .../wallNormalInfo/wallNormalInfo.H | 18 +-- .../layeredSolver/pointEdgeStructuredWalk.H | 12 +- .../pointPatchDist/externalPointEdgePoint.H | 18 +-- .../pointEdgeCollapse/pointEdgeCollapse.H | 18 +-- .../polyTopoChange/refinementData.H | 20 ++- .../polyTopoChange/refinementDistanceData.H | 18 +-- .../finiteVolume/fvc/fvcSmooth/smoothData.H | 11 +- .../finiteVolume/fvc/fvcSmooth/sweepData.H | 11 +- .../wallDist/wallPointYPlus/wallPointYPlus.H | 14 +- .../field/nearWallFields/findCellParticle.H | 16 +-- .../coalCombustion/coalParcel/coalParcel.H | 9 +- .../basicHeterogeneousReactingParcel.H | 8 +- .../basicKinematicMPPICParcel.H | 8 +- .../basicKinematicParcel.H | 9 +- .../basicReactingMultiphaseParcel.H | 8 +- .../basicReactingParcel/basicReactingParcel.H | 9 +- .../basicThermoParcel/basicThermoParcel.H | 9 +- src/lagrangian/solidParticle/solidParticle.H | 12 +- .../basicSprayParcel/basicSprayParcel.H | 9 +- .../meshRefinement/meshRefinement.H | 5 +- .../meshRefinement/patchFaceOrientation.H | 21 ++- .../meshRefinement/transportData.H | 14 +- .../PointIntegrateData/PointIntegrateData.H | 28 ++-- .../trackedParticle/trackedParticle.C | 3 +- .../trackedParticle/trackedParticle.H | 17 +-- .../PatchEdgeFaceWave/patchEdgeFaceInfo.H | 22 ++- .../PatchEdgeFaceWave/patchEdgeFaceRegion.H | 21 ++- .../algorithms/PointEdgeWave/PointData.H | 33 ++--- .../algorithms/PointEdgeWave/pointEdgePoint.H | 21 ++- src/meshTools/cellClassification/cellInfo.H | 22 +-- src/meshTools/cellDist/wallPoint/wallPoint.H | 20 +-- .../cellDist/wallPoint/wallPointData.H | 55 ++------ .../meshStructure/pointTopoDistanceData.H | 29 ++-- .../meshStructure/topoDistanceData.H | 26 ++-- src/meshTools/regionSplit/minData.H | 21 ++- .../inverseDistance/meshToMeshData.H | 21 ++- .../distributedTriSurfaceMesh.H | 4 +- 120 files changed, 950 insertions(+), 900 deletions(-) diff --git a/applications/test/Hashing/Test-Hashing.C b/applications/test/Hashing/Test-Hashing.C index 35e0bb6dc4..6848274507 100644 --- a/applications/test/Hashing/Test-Hashing.C +++ b/applications/test/Hashing/Test-Hashing.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -78,7 +78,7 @@ void infoHashString void reportHashList(const UList& list) { - Info<< "contiguous = " << contiguous() << nl << nl; + Info<< "contiguous = " << is_contiguous::value << nl << nl; for (const string& val : list) { @@ -91,7 +91,7 @@ void reportHashList(const UList& list) void reportHashList(const UList